Author: spouliot
Date: 2007-12-14 08:49:42 -0500 (Fri, 14 Dec 2007)
New Revision: 91284

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/shape.cpp
Log:
2007-12-14  Sebastien Pouliot  <[EMAIL PROTECTED]> 

        * shape.cpp: Fix Path::GetBrushSize to ensure the geometry has
        been built before calling cairo_stroke_extents. This fix sample
        http://designwithsilverlight.com/tutorials/photoGalleryWall/default.html



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-12-14 13:47:00 UTC (rev 91283)
+++ trunk/moon/src/ChangeLog    2007-12-14 13:49:42 UTC (rev 91284)
@@ -1,3 +1,9 @@
+2007-12-14  Sebastien Pouliot  <[EMAIL PROTECTED]> 
+
+       * shape.cpp: Fix Path::GetBrushSize to ensure the geometry has
+       been built before calling cairo_stroke_extents. This fix sample
+       http://designwithsilverlight.com/tutorials/photoGalleryWall/default.html
+
 2007-12-13  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * shape.cpp|h: Shortcut path bounds calculation when both Width

Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp    2007-12-14 13:47:00 UTC (rev 91283)
+++ trunk/moon/src/shape.cpp    2007-12-14 13:49:42 UTC (rev 91284)
@@ -1799,12 +1799,21 @@
 void
 Path::GetSizeForBrush (cairo_t *cr, double *width, double *height)
 {
-       double x1, y1, x2, y2;
+       Geometry* geometry = path_get_data (this);
+       if (geometry) {
+               // in some cases it's possible that GetSizeForBrush will be 
called before the geometry is built
+               if (!geometry->IsBuilt ())
+                       Draw (cr);
+
+               double x1, y1, x2, y2;
+               cairo_stroke_extents (cr, &x1, &y1, &x2, &y2);
        
-       cairo_stroke_extents (cr, &x1, &y1, &x2, &y2);
-       
-       *height = fabs (y2 - y1);
-       *width = fabs (x2 - x1);
+               *height = fabs (y2 - y1);
+               *width = fabs (x2 - x1);
+       } else {
+               *height = 0.0;
+               *width = 0.0;
+       }
 }
 
 Geometry *

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to