X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/519cb848a8f4c91c73421bb75314754284e593a4..71e483d39adbc1c80ef2fa998bd7f18e1704440c:/src/mac/dcmemory.cpp diff --git a/src/mac/dcmemory.cpp b/src/mac/dcmemory.cpp index 28a652368a..fba8a5891e 100644 --- a/src/mac/dcmemory.cpp +++ b/src/mac/dcmemory.cpp @@ -23,20 +23,38 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) wxMemoryDC::wxMemoryDC(void) { + m_ok = TRUE; + SetBackground(*wxWHITE_BRUSH); + SetBrush(*wxWHITE_BRUSH); + SetPen(*wxBLACK_PEN); m_ok = FALSE; }; wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) { + m_ok = TRUE; + SetBackground(*wxWHITE_BRUSH); + SetBrush(*wxWHITE_BRUSH); + SetPen(*wxBLACK_PEN); m_ok = FALSE; }; wxMemoryDC::~wxMemoryDC(void) { + if ( m_selected.Ok() ) + { + wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ; + UnlockPixels( GetGWorldPixMap( (CGrafPtr) bmap->m_hBitmap ) ) ; + } }; void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) { + if ( m_selected.Ok() ) + { + wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ; + UnlockPixels( GetGWorldPixMap( (CGrafPtr) bmap->m_hBitmap ) ) ; + } m_selected = bitmap; if (m_selected.Ok()) { @@ -44,6 +62,12 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) if ( bmap->m_hBitmap ) { m_macPort = (GrafPtr) bmap->m_hBitmap ; + LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ; + wxMask * mask = bitmap.GetMask() ; + if ( mask ) + { + m_macMask = mask->GetMaskBitmap() ; + } MacSetupPort() ; m_ok = TRUE ; // SetBackground(wxBrush(*wxWHITE, wxSOLID)); @@ -59,7 +83,7 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) }; }; -void wxMemoryDC::GetSize( int *width, int *height ) const +void wxMemoryDC::DoGetSize( int *width, int *height ) const { if (m_selected.Ok()) {