]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/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"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
)
24 wxMemoryDC::wxMemoryDC(void)
27 SetBackground(*wxWHITE_BRUSH
);
28 SetBrush(*wxWHITE_BRUSH
);
33 wxMemoryDC::wxMemoryDC( wxDC
*WXUNUSED(dc
) )
36 SetBackground(*wxWHITE_BRUSH
);
37 SetBrush(*wxWHITE_BRUSH
);
42 wxMemoryDC::~wxMemoryDC(void)
44 if ( m_selected
.Ok() )
46 wxBitmapRefData
* bmap
= (wxBitmapRefData
*) (m_selected
.GetRefData()) ;
47 UnlockPixels( GetGWorldPixMap( (CGrafPtr
) bmap
->m_hBitmap
) ) ;
51 void wxMemoryDC::SelectObject( const wxBitmap
& bitmap
)
53 if ( m_selected
.Ok() )
55 wxBitmapRefData
* bmap
= (wxBitmapRefData
*) (m_selected
.GetRefData()) ;
56 UnlockPixels( GetGWorldPixMap( (CGrafPtr
) bmap
->m_hBitmap
) ) ;
61 wxBitmapRefData
* bmap
= (wxBitmapRefData
*) (m_selected
.GetRefData()) ;
62 if ( bmap
->m_hBitmap
)
64 m_macPort
= (GrafPtr
) bmap
->m_hBitmap
;
65 LockPixels( GetGWorldPixMap( (CGrafPtr
) m_macPort
) ) ;
66 wxMask
* mask
= bitmap
.GetMask() ;
69 m_macMask
= mask
->GetMaskBitmap() ;
73 // SetBackground(wxBrush(*wxWHITE, wxSOLID));
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;