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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 944
Date       : Wed May  3 11:02:21 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/osrndrgn.cpp

Work around wxWidgets brush bug to stop galleries being hatched


Diff:
Index: Trunk/XaraLX/wxOil/osrndrgn.cpp
===================================================================
--- Trunk/XaraLX/wxOil/osrndrgn.cpp	(revision 943)
+++ Trunk/XaraLX/wxOil/osrndrgn.cpp	(revision 944)
@@ -2248,9 +2248,23 @@
 	{
 //		Rect.x--;
 
+		// wxWidgets seems to corrupt the current brush here, which we need to preserve
+		wxBrush SaveBrush=RenderDC->GetBrush();
+		INT32 SaveBackgroundMode=RenderDC->GetBackgroundMode();
+
+		// Draw the text
 		RenderDC->SetBackgroundMode(wxTRANSPARENT);
 		RenderDC->DrawText(Text, Rect.GetLeft(), Rect.GetTop());
 
+		// Restore the brush. First we have to ensure SetBrush really works. This is
+		// because the GTK brush is corrupted whilst the wxWidgets one is still right.
+		// So we have to select a different brush or wxWidgets will skip the call
+		// that would otherwise fix the GTK brush
+		RenderDC->SetBackgroundMode(SaveBackgroundMode);
+		RenderDC->SetBrush(*wxTRANSPARENT_BRUSH);
+		RenderDC->SetBrush(wxNullBrush);
+		RenderDC->SetBrush(SaveBrush);
+
 //		LineHeight = RenderDC->DrawText((TCHAR *) (*TheText), -1, &Rect, uFormat);
 
 //		ENSURE(LineHeight > 0, "OSRenderRegion::DrawFixedSystemText failed");


Xara