]> git.saurik.com Git - wxWidgets.git/commitdiff
silence warnings about not using double-buffered surface in wxScreenDC ; add comment...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 27 May 2008 16:28:28 +0000 (16:28 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 27 May 2008 16:28:28 +0000 (16:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/dfb/dcscreen.cpp
src/dfb/wrapdfb.cpp

index ce892be03616c50b66c3186b820e57ea5af90e7a..db19dc53a1f20563d99fd46adec38f651aa599ca 100644 (file)
 // wxScreenDC
 //-----------------------------------------------------------------------------
 
-#warning "FIXME: this doesn't work (neither single app nor multiapp core)"
-// FIXME: maybe use a subsurface as well?
+// FIXME: Currently, wxScreenDC doesn't work at all in non-exclusive mode
+//        (DFSCL_NORMAL). In this mode, requesting primary surface results
+//        in one of the following actions, depending on directfbrc
+//        configuration:
+//
+//        (1) if force-desktop, a surface is created and used as *background*
+//            for the windows managed by DFB WM
+//
+//        (2) otherwise, a dummy surface of the right size and format is
+//            created, but isn't shown on the screen
+//
+//        (3) furthermore, if autoflip-window option is not used and primary
+//            surface is requested as single-buffered (which is needed to
+//            implement wxScreenDC semantics), a warning is issued in addition
+//            to 2); if autoflip-window is used, then a helper thread is
+//            created and does periodic flipping, which is even worse
+//
+//        2) and 3) are obviously unsatisfactory. 1) isn't suitable either,
+//        because wxScreenDC has to render *on top* of windows.
+//
+//        In conclusion, wxScreenDC as currently implemented is only usable
+//        for measuring things (e.g. font sizes). For this task, however, it
+//        is quite expensive to create in DFSCL_NORMAL mode, because it
+//        involves creation of a new surface as big as the screen.
+//
+//        The surface, as obtained from GetPrimarySurface(), is double-buffered
+//        for the sole purpose of silencing the warning from 3) above.
 
 IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxDFBDCImpl)
 
@@ -41,5 +66,3 @@ wxScreenDCImpl::wxScreenDCImpl(wxScreenDC *owner)
 {
     DFBInit(wxIDirectFB::Get()->GetPrimarySurface());
 }
-
-#warning "FIXME: does wxScreenDC need Flip call in dtor?"
index e05ad09541b4500b12a8271234b739d97c170a6b..c474b48e2b44c8482e0e7be30d40f4575888aaf8 100644 (file)
@@ -105,7 +105,13 @@ wxIDirectFBSurfacePtr wxIDirectFB::GetPrimarySurface()
 {
     DFBSurfaceDescription desc;
     desc.flags = DSDESC_CAPS;
-    desc.caps = DSCAPS_PRIMARY;
+    // NB: see dcscreen.cpp for why we request double-buffered surface
+    //
+    //     This assumes the cooperative level is DFSCL_NORMAL (that's the
+    //     default and wx doesn't modify it anywhere); if we ever support
+    //     other cooperative levels, DSCAPS_DOUBLE should *not* be used with
+    //     them.
+    desc.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY | DSCAPS_DOUBLE);
     return CreateSurface(&desc);
 }