[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 864
Date       : Sat Apr 22 19:51:59 BST 2006

Changed paths:
   M /Trunk/XaraLX/Scripts/barconverter
   M /Trunk/XaraLX/wxOil/dlgmgr.cpp
   M /Trunk/XaraLX/wxOil/drawctl.cpp
   M /Trunk/XaraLX/wxOil/drawctl.h
   M /Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc

Fix clip rect issues on kernel rendered redraw


Diff:
Index: Trunk/XaraLX/Scripts/barconverter
===================================================================
--- Trunk/XaraLX/Scripts/barconverter	(revision 863)
+++ Trunk/XaraLX/Scripts/barconverter	(revision 864)
@@ -236,6 +236,7 @@
     printf STDOUT $ddindent."            <border>%d</border>
",$dd?0:1;
     print STDOUT $ddindent. "            <object class=\"wxCamDrawControl\" name=\"IDC_GALLERY_LISTBOX\">
";
     print STDOUT $ddindent. "                <style>wxFULL_REPAINT_ON_RESIZE</style>
";
+    print STDOUT $ddindent. "                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
";
     print STDOUT $ddindent. "                <size>400,400</size>
";
     print STDOUT $ddindent. "            </object>
";
     print STDOUT $ddindent. "        </object>
";
Index: Trunk/XaraLX/wxOil/drawctl.h
===================================================================
--- Trunk/XaraLX/wxOil/drawctl.h	(revision 863)
+++ Trunk/XaraLX/wxOil/drawctl.h	(revision 864)
@@ -106,7 +106,8 @@
 	// Caching flags start here - the art provider may have a different bitmap depending on the
 	// state of these flags...
 
-	wxCDCS_DEFAULT			= 0
+	wxCDCS_DEFAULT			= 0,
+	wxCDCS_SETCLIPRECT		= 1<<0
 };
 
 /*******************************************************************************************
Index: Trunk/XaraLX/wxOil/drawctl.cpp
===================================================================
--- Trunk/XaraLX/wxOil/drawctl.cpp	(revision 863)
+++ Trunk/XaraLX/wxOil/drawctl.cpp	(revision 864)
@@ -298,6 +298,7 @@
 wxCamDrawControlXmlHandler::wxCamDrawControlXmlHandler() : wxXmlResourceHandler()
 {
 	XRC_ADD_STYLE(wxCDCS_DEFAULT);
+	XRC_ADD_STYLE(wxCDCS_SETCLIPRECT);
 	AddWindowStyles();
 }
 
Index: Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc	(revision 863)
+++ Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc	(revision 864)
@@ -1580,6 +1580,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -1769,6 +1770,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -1955,6 +1957,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -2262,6 +2265,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -2377,6 +2381,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -2641,6 +2646,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -2881,6 +2887,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -3146,6 +3153,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
@@ -3406,6 +3414,7 @@
             <border>1</border>
             <object class="wxCamDrawControl" name="IDC_GALLERY_LISTBOX">
                 <style>wxFULL_REPAINT_ON_RESIZE</style>
+                <camdrawstyle>wxCDCS_SETCLIPRECT</camdrawstyle>
                 <size>400,400</size>
             </object>
         </object>
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 863)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 864)
@@ -979,13 +979,33 @@
 
 			wxRegionIterator upd(pGadget->GetUpdateRegion()); // get the update rect list
 
-			while (upd)
+			BOOL Stop = FALSE;
+
+			while (upd && !Stop)
 			{
 				// Alternatively we can do this:
 				wxRect ClipRect(upd.GetRect());
-				// Should we clip this to the WindowSize here?
-				// MyDC.SetClipRect(ClipRect);
+				// Should we clip this to the WindowSize here? For reasons which are not entirely clear, setting the
+				// ClipRect breaks GRenderRegions. But if we don't set the clip rect, it breaks (at least some)
+				// code that uses OSRenderRegion (sigh). Right now this is too painful to debug, so instead we
+				// cop out, and ask the control whether or not it would like a ClipRect set. Those that say no
+				// will paint the entire area, so we only give them one call
+
+				BOOL UseClipRect = (pGadget->IsKindOf(CLASSINFO(wxCamDrawControl)))
+									&& (((wxCamDrawControl*)pGadget)->GetStyle() & wxCDCS_SETCLIPRECT);
+
+				if (UseClipRect)
+				{
+					MyDc.SetClippingRegion(ClipRect);
+				}
+				else
+				{
+					ClipRect = wxRect(WindowSize);
+					Stop = TRUE; // cease drawing after this one
+				}
 				
+				ClipRect.Inflate(1,1);  // Inflate by one pixel to get around wxRect stupidity
+
 				DocRect DocClipRect;
 			
 				// Convert to millipoints, Also need to flip the y coords to get a


Xara