]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMemoryDC class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "dcmemory.h"
16 #include "wx/dcmemory.h"
17 #include "wx/mac/private.h"
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
)
25 wxMemoryDC::wxMemoryDC(void)
28 SetBackground(*wxWHITE_BRUSH
);
29 SetBrush(*wxWHITE_BRUSH
);
34 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
37 SetBackground(*wxWHITE_BRUSH
);
38 SetBrush(*wxWHITE_BRUSH
);
43 wxMemoryDC::~wxMemoryDC()
45 if ( m_selected
.Ok() )
47 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
51 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
53 if ( m_selected
.Ok() )
55 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
60 if ( m_selected
.GetHBITMAP() )
62 m_macPort
= (GrafPtr
) m_selected
.GetHBITMAP() ;
63 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
64 wxMask
* mask
= bitmap
.GetMask() ;
67 m_macMask
= mask
->GetMaskBitmap() ;
69 SetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, 0 , 0 , m_selected
.GetWidth() , m_selected
.GetHeight() ) ;
70 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
,(RgnHandle
) m_macCurrentClipRgn
) ;
84 void wxMemoryDC::DoGetSize( int *width
, int *height
) const
88 if (width
) (*width
) = m_selected
.GetWidth();
89 if (height
) (*height
) = m_selected
.GetHeight();
93 if (width
) (*width
) = 0;
94 if (height
) (*height
) = 0;