]> git.saurik.com Git - wxWidgets.git/blob - src/dfb/dcmemory.cpp
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[wxWidgets.git] / src / dfb / dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/dcmemory.cpp
3 // Purpose: wxMemoryDCImpl implementation
4 // Author: Vaclav Slavik
5 // Created: 2006-08-16
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ===========================================================================
12 // declarations
13 // ===========================================================================
14
15 // ---------------------------------------------------------------------------
16 // headers
17 // ---------------------------------------------------------------------------
18
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifndef WX_PRECOMP
23 #include "wx/bitmap.h"
24 #endif
25
26 #include "wx/dcmemory.h"
27 #include "wx/dfb/dcmemory.h"
28 #include "wx/dfb/private.h"
29
30 // ===========================================================================
31 // implementation
32 // ===========================================================================
33
34 //-----------------------------------------------------------------------------
35 // wxMemoryDCImpl
36 //-----------------------------------------------------------------------------
37
38 #warning "FIXME: verify/fix that wxMemoryDCImpl works correctly with mono bitmaps"
39
40 IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxDFBDCImpl)
41
42 void wxMemoryDCImpl::Init()
43 {
44 }
45
46 wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner)
47 : wxDFBDCImpl(owner)
48 {
49 Init();
50 }
51
52 wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner, wxBitmap& bitmap)
53 : wxDFBDCImpl(owner)
54 {
55 Init();
56 DoSelect(bitmap);
57 }
58
59 wxMemoryDCImpl::wxMemoryDCImpl(wxMemoryDC *owner, wxDC *WXUNUSED(dc))
60 : wxDFBDCImpl(owner)
61 {
62 }
63
64 void wxMemoryDCImpl::DoSelect(const wxBitmap& bitmap)
65 {
66 m_bmp = bitmap;
67
68 if ( !bitmap.IsOk() )
69 {
70 // select the bitmap out of the DC
71 m_surface = NULL;
72 return;
73 }
74
75 // init the DC for drawing to this bitmap
76 DFBInit(bitmap.GetDirectFBSurface());
77 }