]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/classic/dcmemory.cpp
3 // Purpose: wxMemoryDC class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/dcmemory.h"
16 #include "wx/mac/private.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
)
24 wxMemoryDC::wxMemoryDC(void)
28 SetBackground(*wxWHITE_BRUSH
);
29 SetBrush(*wxWHITE_BRUSH
);
34 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
38 SetBackground(*wxWHITE_BRUSH
);
39 SetBrush(*wxWHITE_BRUSH
);
44 wxMemoryDC::~wxMemoryDC()
46 if ( m_selected
.Ok() )
48 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
52 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
54 if ( m_selected
.Ok() )
56 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
61 if ( m_selected
.GetHBITMAP() )
63 m_macPort
= (GrafPtr
) m_selected
.GetHBITMAP() ;
64 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
65 wxMask
* mask
= bitmap
.GetMask() ;
68 m_macMask
= mask
->GetMaskBitmap() ;
70 SetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, 0 , 0 , m_selected
.GetWidth() , m_selected
.GetHeight() ) ;
71 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
,(RgnHandle
) m_macCurrentClipRgn
) ;
85 void wxMemoryDC::DoGetSize( int *width
, int *height
) const
89 if (width
) (*width
) = m_selected
.GetWidth();
90 if (height
) (*height
) = m_selected
.GetHeight();
94 if (width
) (*width
) = 0;
95 if (height
) (*height
) = 0;