X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/519cb848a8f4c91c73421bb75314754284e593a4..bada28f00f12666ef31f0543cea2cde86b7935c7:/src/mac/carbon/dcmemory.cpp diff --git a/src/mac/carbon/dcmemory.cpp b/src/mac/carbon/dcmemory.cpp index 28a652368a..a56c7b5c49 100644 --- a/src/mac/carbon/dcmemory.cpp +++ b/src/mac/carbon/dcmemory.cpp @@ -33,10 +33,20 @@ wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) 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 +54,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));