]> git.saurik.com Git - wxWidgets.git/blob - src/mac/dcmemory.cpp
1. fixed memory leak in GAddress
[wxWidgets.git] / src / mac / dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcmemory.cpp
3 // Purpose: wxMemoryDC class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "dcmemory.h"
14 #endif
15
16 #include "wx/dcmemory.h"
17
18 //-----------------------------------------------------------------------------
19 // wxMemoryDC
20 //-----------------------------------------------------------------------------
21
22 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
23
24 wxMemoryDC::wxMemoryDC(void)
25 {
26 m_ok = FALSE;
27 };
28
29 wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
30 {
31 m_ok = FALSE;
32 };
33
34 wxMemoryDC::~wxMemoryDC(void)
35 {
36 };
37
38 void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
39 {
40 m_selected = bitmap;
41 if (m_selected.Ok())
42 {
43 wxBitmapRefData * bmap = (wxBitmapRefData*) (m_selected.GetRefData()) ;
44 if ( bmap->m_hBitmap )
45 {
46 m_macPort = (GrafPtr) bmap->m_hBitmap ;
47 wxMask * mask = bitmap.GetMask() ;
48 if ( mask )
49 {
50 m_macMask = mask->GetMaskBitmap() ;
51 }
52 MacSetupPort() ;
53 m_ok = TRUE ;
54 // SetBackground(wxBrush(*wxWHITE, wxSOLID));
55 }
56 else
57 {
58 m_ok = FALSE;
59 }
60 }
61 else
62 {
63 m_ok = FALSE;
64 };
65 };
66
67 void wxMemoryDC::GetSize( int *width, int *height ) const
68 {
69 if (m_selected.Ok())
70 {
71 if (width) (*width) = m_selected.GetWidth();
72 if (height) (*height) = m_selected.GetHeight();
73 }
74 else
75 {
76 if (width) (*width) = 0;
77 if (height) (*height) = 0;
78 };
79 };
80
81