wxMemoryDC constructor now optionally accepts a wxBitmap parameter,
[wxWidgets.git] / src / dfb / dcmemory.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/dcmemory.cpp
3 // Purpose: wxMemoryDC 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 #include "wx/dcmemory.h"
23
24 #ifndef WX_PRECOMP
25 #include "wx/bitmap.h"
26 #endif
27
28 #include "wx/dfb/private.h"
29
30 // ===========================================================================
31 // implementation
32 // ===========================================================================
33
34 //-----------------------------------------------------------------------------
35 // wxMemoryDC
36 //-----------------------------------------------------------------------------
37
38 #warning "FIXME: verify/fix that wxMemoryDC works correctly with mono bitmaps"
39
40 IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
41
42 wxMemoryDC::wxMemoryDC( const wxBitmap& bitmap )
43 {
44 if ( bitmap.IsOk() )
45 SelectObject(bitmap);
46 }
47
48 wxMemoryDC::wxMemoryDC(wxDC *WXUNUSED(dc))
49 {
50 }
51
52 void wxMemoryDC::SelectObject(const wxBitmap& bitmap)
53 {
54 m_bmp = bitmap;
55
56 if ( !bitmap.Ok() )
57 {
58 // select the bitmap out of the DC
59 m_surface = NULL;
60 return;
61 }
62
63 // init the DC for drawing to this bitmap
64 Init(bitmap.GetDirectFBSurface());
65 }