]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMemoryDC class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/dcmemory.h"
13 #include "wx/mac/private.h"
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
19 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
)
21 wxMemoryDC::wxMemoryDC(void)
25 SetBackground(*wxWHITE_BRUSH
);
26 SetBrush(*wxWHITE_BRUSH
);
31 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
35 SetBackground(*wxWHITE_BRUSH
);
36 SetBrush(*wxWHITE_BRUSH
);
41 wxMemoryDC::~wxMemoryDC()
43 if ( m_selected
.Ok() )
45 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
49 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
51 if ( m_selected
.Ok() )
53 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
58 if ( m_selected
.GetHBITMAP() )
60 m_macPort
= (GrafPtr
) m_selected
.GetHBITMAP() ;
61 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
62 wxMask
* mask
= bitmap
.GetMask() ;
65 m_macMask
= mask
->GetMaskBitmap() ;
67 SetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, 0 , 0 , m_selected
.GetWidth() , m_selected
.GetHeight() ) ;
68 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
,(RgnHandle
) m_macCurrentClipRgn
) ;
82 void wxMemoryDC::DoGetSize( int *width
, int *height
) const
86 if (width
) (*width
) = m_selected
.GetWidth();
87 if (height
) (*height
) = m_selected
.GetHeight();
91 if (width
) (*width
) = 0;
92 if (height
) (*height
) = 0;