]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/dcbuffer.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: generic/dcbuffer.cpp
3 // Purpose: wxBufferedDC class
4 // Author: Ron Lee <ron@debian.org>
5 // Modified by: Vadim Zeitlin (refactored, added bg preservation)
8 // Copyright: (c) Ron Lee
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "dcbuffer.h"
16 #include "wx/wxprec.h"
23 #include "wx/window.h"
26 #include "wx/dcbuffer.h"
28 // ----------------------------------------------------------------------------
29 // Double buffering helper.
30 // ----------------------------------------------------------------------------
32 wxBufferedDC::wxBufferedDC(wxDC
*dc
, const wxBitmap
& buffer
)
39 wxBufferedDC::wxBufferedDC(wxDC
*dc
, const wxSize
& area
, int flags
)
41 m_buffer( area
.GetWidth(), area
.GetHeight() )
48 void wxBufferedDC::Init( wxDC
*dc
, const wxBitmap
&buffer
)
50 wxASSERT_MSG( m_dc
== 0 && m_buffer
== wxNullBitmap
,
51 _T("wxBufferedDC already initialised") );
59 void wxBufferedDC::Init(wxDC
*dc
, const wxSize
& area
, int flags
)
61 Init(dc
, wxBitmap(area
.GetWidth(), area
.GetHeight()));
66 void wxBufferedDC::UnMask()
68 wxASSERT_MSG( m_dc
!= 0,
69 _T("No underlying DC associated with wxBufferedDC (anymore)") );
71 m_dc
->Blit( 0, 0, m_buffer
.GetWidth(), m_buffer
.GetHeight(), this, 0, 0 );