]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxMemoryDC class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "dcmemory.h"
16 #include "wx/wxprec.h"
18 #include "wx/dcmemory.h"
19 #include "wx/mac/private.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
)
27 wxMemoryDC::wxMemoryDC(void)
31 SetBackground(*wxWHITE_BRUSH
);
32 SetBrush(*wxWHITE_BRUSH
);
37 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
41 SetBackground(*wxWHITE_BRUSH
);
42 SetBrush(*wxWHITE_BRUSH
);
47 wxMemoryDC::~wxMemoryDC()
49 if ( m_selected
.Ok() )
51 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
55 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
57 if ( m_selected
.Ok() )
59 UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected
.GetHBITMAP())) );
64 if ( m_selected
.GetHBITMAP() )
66 m_macPort
= (GrafPtr
) m_selected
.GetHBITMAP() ;
67 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
68 wxMask
* mask
= bitmap
.GetMask() ;
71 m_macMask
= mask
->GetMaskBitmap() ;
73 SetRectRgn( (RgnHandle
) m_macBoundaryClipRgn
, 0 , 0 , m_selected
.GetWidth() , m_selected
.GetHeight() ) ;
74 CopyRgn( (RgnHandle
) m_macBoundaryClipRgn
,(RgnHandle
) m_macCurrentClipRgn
) ;
88 void wxMemoryDC::DoGetSize( int *width
, int *height
) const
92 if (width
) (*width
) = m_selected
.GetWidth();
93 if (height
) (*height
) = m_selected
.GetHeight();
97 if (width
) (*width
) = 0;
98 if (height
) (*height
) = 0;