]> git.saurik.com Git - wxWidgets.git/blobdiff - src/dfb/overlay.cpp
always use hw-accel, fixes #15536, applied with thanks
[wxWidgets.git] / src / dfb / overlay.cpp
index 80ee371efecb660ffbf3c2c3fa2d8ef1babbbdba..d264ecf4b889d4e7f2a97b3fd38c20dd31262a02 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxOverlay implementation for wxDFB
 // Author:      Vaclav Slavik
 // Created:     2006-10-20
-// RCS-ID:      $Id$
 // Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -29,6 +28,7 @@
 #endif
 
 #include "wx/private/overlay.h"
+#include "wx/dfb/dcclient.h"
 #include "wx/dfb/private.h"
 
 // ============================================================================
@@ -55,10 +55,14 @@ bool wxOverlayImpl::IsOk()
     return m_window != NULL;
 }
 
-void wxOverlayImpl::Init(wxWindowDC *dc, int x, int y, int width, int height)
+void wxOverlayImpl::Init(wxDC *dc, int x, int y, int width, int height)
 {
+    wxCHECK_RET( dc, "NULL dc pointer" );
     wxASSERT_MSG( !IsOk() , _("You cannot Init an overlay twice") );
 
+    wxDFBDCImpl * const dcimpl = wxDynamicCast(dc->GetImpl(), wxDFBDCImpl);
+    wxCHECK_RET( dcimpl, "must have a DFB wxDC" );
+
     m_window = dc->GetWindow();
 
     m_rect = wxRect(x, y, width, height);
@@ -66,18 +70,22 @@ void wxOverlayImpl::Init(wxWindowDC *dc, int x, int y, int width, int height)
         m_rect.Offset(m_window->GetClientAreaOrigin());
 
     // FIXME: create surface with transparency or key color (?)
-    m_surface =
-        dc->GetDirectFBSurface()->CreateCompatible
-                   (
-                       m_rect.GetSize(),
-                       wxIDirectFBSurface::CreateCompatible_NoBackBuffer
-                   );
+    m_surface = dcimpl->GetDirectFBSurface()->CreateCompatible
+                (
+                   m_rect.GetSize(),
+                   wxIDirectFBSurface::CreateCompatible_NoBackBuffer
+                );
 
     m_window->AddOverlay(this);
 }
 
-void wxOverlayImpl::BeginDrawing(wxWindowDC *dc)
+void wxOverlayImpl::BeginDrawing(wxDC *dc)
 {
+    wxCHECK_RET( dc, "NULL dc pointer" );
+
+    wxWindowDCImpl * const
+        dcimpl = static_cast<wxWindowDCImpl *>(dc->GetImpl());
+
     wxPoint origin(m_rect.GetPosition());
     if ( wxDynamicCast(dc, wxClientDC) )
         origin -= m_window->GetClientAreaOrigin();
@@ -86,19 +94,19 @@ void wxOverlayImpl::BeginDrawing(wxWindowDC *dc)
     // another DC, so we have to change the DC to draw on the overlay's surface.
     // Setting m_shouldFlip is done to avoid flipping and drawing of overlays
     // in ~wxWindowDC (we do it EndDrawing).
-    dc->DFBInit(m_surface);
+    dcimpl->DFBInit(m_surface);
+    dcimpl->m_shouldFlip = false;
     dc->SetDeviceOrigin(-origin.x, -origin.y);
-    dc->m_shouldFlip = false;
 
     m_isEmpty = false;
 }
 
-void wxOverlayImpl::EndDrawing(wxWindowDC *dc)
+void wxOverlayImpl::EndDrawing(wxDC *WXUNUSED(dc))
 {
     m_window->RefreshWindowRect(m_rect);
 }
 
-void wxOverlayImpl::Clear(wxWindowDC *dc)
+void wxOverlayImpl::Clear(wxDC *WXUNUSED(dc))
 {
     wxASSERT_MSG( IsOk(),
                   "You cannot Clear an overlay that is not initialized" );