]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/classic/dcmemory.cpp
   1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        src/mac/classic/dcmemory.cpp 
   3 // Purpose:     wxMemoryDC class 
   4 // Author:      Stefan Csomor 
   8 // Copyright:   (c) Stefan Csomor 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #include "wx/wxprec.h" 
  14 #include "wx/dcmemory.h" 
  16 #include "wx/mac/private.h" 
  18 //----------------------------------------------------------------------------- 
  20 //----------------------------------------------------------------------------- 
  22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC
,wxPaintDC
) 
  24 wxMemoryDC::wxMemoryDC( const wxBitmap
& bitmap 
) 
  28     SetBackground(*wxWHITE_BRUSH
); 
  29     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;