]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/graphics.cpp
Add persistence support for wxSplitterWindow.
[wxWidgets.git] / src / msw / graphics.cpp
index 3c8e85fe8a99b3aaf7f4c1a6e6d1b428540d11e3..88d5fb55941455a14ca6401a0cb02a9d90c8cd62 100644 (file)
@@ -1547,6 +1547,8 @@ void wxGDIPlusContext::PushState()
 
 void wxGDIPlusContext::PopState()
 {
+    wxCHECK_RET( !m_stateStack.empty(), wxT("No state to pop") );
+
     GraphicsState state = m_stateStack.top();
     m_stateStack.pop();
     m_context->Restore(state);
@@ -1904,7 +1906,7 @@ void wxGDIPlusRenderer::Unload()
     if ( m_gditoken )
     {
         GdiplusShutdown(m_gditoken);
-        m_gditoken = NULL;
+        m_gditoken = 0;
     }
     m_loaded = -1; // next Load() will try again
 }
@@ -2125,6 +2127,14 @@ WXHDC wxGCDC::AcquireHDC()
     if ( !gc )
         return NULL;
 
+#if wxUSE_CAIRO
+    // we can't get the HDC if it is not a GDI+ context
+    wxGraphicsRenderer* r1 = gc->GetRenderer();
+    wxGraphicsRenderer* r2 = wxGraphicsRenderer::GetCairoRenderer();
+    if (r1 == r2)
+        return NULL;
+#endif
+
     Graphics * const g = static_cast<Graphics *>(gc->GetNativeContext());
     return g ? g->GetHDC() : NULL;
 }
@@ -2137,6 +2147,14 @@ void wxGCDC::ReleaseHDC(WXHDC hdc)
     wxGraphicsContext * const gc = GetGraphicsContext();
     wxCHECK_RET( gc, "can't release HDC because there is no wxGraphicsContext" );
 
+#if wxUSE_CAIRO
+    // we can't get the HDC if it is not a GDI+ context
+    wxGraphicsRenderer* r1 = gc->GetRenderer();
+    wxGraphicsRenderer* r2 = wxGraphicsRenderer::GetCairoRenderer();
+    if (r1 == r2)
+        return;
+#endif
+
     Graphics * const g = static_cast<Graphics *>(gc->GetNativeContext());
     wxCHECK_RET( g, "can't release HDC because there is no Graphics" );