]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMemoryDC class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
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)
29 SetBackground(*wxWHITE_BRUSH
);
30 SetBrush(*wxWHITE_BRUSH
);
35 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
39 SetBackground(*wxWHITE_BRUSH
);
40 SetBrush(*wxWHITE_BRUSH
);
45 wxMemoryDC::~wxMemoryDC()
47 if ( m_selected
.Ok() )
49 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
53 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
55 if ( m_selected
.Ok() )
57 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
62 if ( m_selected
.GetHBITMAP() )
64 m_macPort
= (GrafPtr
) m_selected
.GetHBITMAP() ;
65 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
66 wxMask
* mask
= bitmap
.GetMask() ;
69 m_macMask
= mask
->GetMaskBitmap() ;
71 SetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, 0 , 0 , m_selected
.GetWidth() , m_selected
.GetHeight() ) ;
72 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
,(RgnHandle
) m_macCurrentClipRgn
) ;
86 void wxMemoryDC::DoGetSize( int *width
, int *height
) const
90 if (width
) (*width
) = m_selected
.GetWidth();
91 if (height
) (*height
) = m_selected
.GetHeight();
95 if (width
) (*width
) = 0;
96 if (height
) (*height
) = 0;