| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/dfb/dcscreen.cpp |
| 3 | // Purpose: wxScreenDC 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/dcscreen.h" |
| 23 | #include "wx/dfb/dcscreen.h" |
| 24 | #include "wx/dfb/private.h" |
| 25 | |
| 26 | // =========================================================================== |
| 27 | // implementation |
| 28 | // =========================================================================== |
| 29 | |
| 30 | //----------------------------------------------------------------------------- |
| 31 | // wxScreenDC |
| 32 | //----------------------------------------------------------------------------- |
| 33 | |
| 34 | // FIXME: Currently, wxScreenDC doesn't work at all in non-exclusive mode |
| 35 | // (DFSCL_NORMAL). In this mode, requesting primary surface results |
| 36 | // in one of the following actions, depending on directfbrc |
| 37 | // configuration: |
| 38 | // |
| 39 | // (1) if force-desktop, a surface is created and used as *background* |
| 40 | // for the windows managed by DFB WM |
| 41 | // |
| 42 | // (2) otherwise, a dummy surface of the right size and format is |
| 43 | // created, but isn't shown on the screen |
| 44 | // |
| 45 | // (3) furthermore, if autoflip-window option is not used and primary |
| 46 | // surface is requested as single-buffered (which is needed to |
| 47 | // implement wxScreenDC semantics), a warning is issued in addition |
| 48 | // to 2); if autoflip-window is used, then a helper thread is |
| 49 | // created and does periodic flipping, which is even worse |
| 50 | // |
| 51 | // 2) and 3) are obviously unsatisfactory. 1) isn't suitable either, |
| 52 | // because wxScreenDC has to render *on top* of windows. |
| 53 | // |
| 54 | // In conclusion, wxScreenDC as currently implemented is only usable |
| 55 | // for measuring things (e.g. font sizes). For this task, however, it |
| 56 | // is quite expensive to create in DFSCL_NORMAL mode, because it |
| 57 | // involves creation of a new surface as big as the screen. |
| 58 | // |
| 59 | // The surface, as obtained from GetPrimarySurface(), is double-buffered |
| 60 | // for the sole purpose of silencing the warning from 3) above. |
| 61 | |
| 62 | IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxDFBDCImpl) |
| 63 | |
| 64 | wxScreenDCImpl::wxScreenDCImpl(wxScreenDC *owner) |
| 65 | : wxDFBDCImpl(owner) |
| 66 | { |
| 67 | DFBInit(wxIDirectFB::Get()->GetPrimarySurface()); |
| 68 | } |