]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxGCDC::Clear() for Cairo, and possibly MSW.
authorPaul Cornett <paulcor@bullseye.com>
Thu, 2 Aug 2012 16:25:14 +0000 (16:25 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Thu, 2 Aug 2012 16:25:14 +0000 (16:25 +0000)
Maximum positive coordinate Cairo can handle is 2^23 - 1.
Also convert coordinates to logical so it works right with modified origin or scale.
See #14529

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72279 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/dcgraph.cpp

index 5f79c36eb73c0dedf4c1ec7914b25f61cc144520..7cadde13953dec7217ba721dd7cc9c65c3d7dfe3 100644 (file)
@@ -38,8 +38,6 @@
 #endif
 #endif
 
-#include <limits.h>     // for INT_MAX
-
 //-----------------------------------------------------------------------------
 // constants
 //-----------------------------------------------------------------------------
@@ -1060,7 +1058,10 @@ void wxGCDCImpl::Clear(void)
     m_graphicContext->SetPen( p );
     wxCompositionMode formerMode = m_graphicContext->GetCompositionMode();
     m_graphicContext->SetCompositionMode(wxCOMPOSITION_SOURCE);
-    DoDrawRectangle( 0, 0, INT_MAX , INT_MAX );
+    // maximum positive coordinate Cairo can handle is 2^23 - 1
+    DoDrawRectangle(
+        DeviceToLogicalX(0), DeviceToLogicalY(0),
+        DeviceToLogicalXRel(0x007fffff), DeviceToLogicalYRel(0x007fffff));
     m_graphicContext->SetCompositionMode(formerMode);
     m_graphicContext->SetPen( m_pen );
     m_graphicContext->SetBrush( m_brush );