Author: lewing
Date: 2008-02-07 14:23:30 -0500 (Thu, 07 Feb 2008)
New Revision: 95181

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/shape.cpp
   trunk/moon/src/shape.h
Log:
2008-02-07  Larry Ewing  <[EMAIL PROTECTED]>

        * shape.cpp: cache the results of CompouteShapeBounds in
        extents rect, use that value in GetSizeForBrush.


Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2008-02-07 19:15:53 UTC (rev 95180)
+++ trunk/moon/src/ChangeLog    2008-02-07 19:23:30 UTC (rev 95181)
@@ -1,3 +1,8 @@
+2008-02-07  Larry Ewing  <[EMAIL PROTECTED]>
+
+       * shape.cpp: cache the results of CompouteShapeBounds in
+       shape_bounds rect, use that value in GetSizeForBrush.
+
 2008-02-07  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
        Fixes a rendering glitch for xaml similar to:

Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp    2008-02-07 19:15:53 UTC (rev 95180)
+++ trunk/moon/src/shape.cpp    2008-02-07 19:23:30 UTC (rev 95181)
@@ -319,7 +319,7 @@
 void
 Shape::ComputeBounds ()
 {
-       Rect shape_bounds = ComputeShapeBounds ();
+       hape_bounds = ComputeShapeBounds ();
        bounds = bounding_rect_for_transformed_rect (&absolute_xform,
                       IntersectBoundsWithClipPath (shape_bounds, false));
        //printf ("%f,%f,%f,%f\n", bounds.x, bounds.y, bounds.w, bounds.h);
@@ -363,26 +363,8 @@
 void
 Shape::GetSizeForBrush (cairo_t *cr, double *width, double *height)
 {
-       double h = framework_element_get_height (this);
-       double w = framework_element_get_width (this);
-       Stretch stretch = shape_get_stretch (this);
-       switch (stretch) {
-       case StretchUniform:
-               w = h = (w < h) ? w : h;
-               break;
-       case StretchUniformToFill:
-               w = h = (w > h) ? w : h;
-               break;
-       case StretchFill:
-               /* nothing needed here.  the assignment of w/h above
-                  is correct for this case. */
-               break;
-       case StretchNone:
-               break;
-       }
-
-       *height = h;
-       *width = w;
+       *height = shape_bounds.h;
+       *width = shape_bounds.w;
 }
 
 bool
@@ -1637,17 +1619,6 @@
        Invalidate ();
 }
 
-void
-Polygon::GetSizeForBrush (cairo_t *cr, double *width, double *height)
-{
-       double x1, y1, x2, y2;
-       
-       cairo_stroke_extents (cr, &x1, &y1, &x2, &y2);
-       
-       *height = fabs (y2 - y1);
-       *width = fabs (x2 - x1);
-}
-
 FillRule
 polygon_get_fill_rule (Polygon *polygon)
 {
@@ -1907,19 +1878,6 @@
        Invalidate ();
 }
 
-void
-Polyline::GetSizeForBrush (cairo_t *cr, double *width, double *height)
-{
-       double x1, y1, x2, y2;
-       
-       cairo_stroke_extents (cr, &x1, &y1, &x2, &y2);
-       
-       *height = fabs (y2 - y1);
-       *width = fabs (x2 - x1);
-}
-
-
-
 FillRule
 polyline_get_fill_rule (Polyline *polyline)
 {
@@ -2131,26 +2089,6 @@
                Shape::OnSubPropertyChanged (prop, obj, subprop);
 }
 
-void
-Path::GetSizeForBrush (cairo_t *cr, double *width, double *height)
-{
-       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);
-       
-               *height = fabs (y2 - y1);
-               *width = fabs (x2 - x1);
-       } else {
-               *height = 0.0;
-               *width = 0.0;
-       }
-}
-
 Geometry *
 path_get_data (Path *path)
 {

Modified: trunk/moon/src/shape.h
===================================================================
--- trunk/moon/src/shape.h      2008-02-07 19:15:53 UTC (rev 95180)
+++ trunk/moon/src/shape.h      2008-02-07 19:23:30 UTC (rev 95181)
@@ -52,6 +52,8 @@
 
        virtual Rect ComputeShapeBounds ();
        virtual Rect ComputeLargestRectangle ();
+       
+       Rect shape_bounds;
  public: 
        static DependencyProperty* FillProperty;
        static DependencyProperty* StretchProperty;
@@ -246,7 +248,6 @@
 
        virtual bool CanFill () { return true; }
 
-       virtual void GetSizeForBrush (cairo_t *cr, double *width, double 
*height);
        virtual bool ClipOnHeightAndWidth () { return true; }
 
        virtual void OnPropertyChanged (DependencyProperty *prop);
@@ -280,7 +281,6 @@
        virtual void BuildPath ();
 
        virtual bool CanFill () { return true; }
-       virtual void GetSizeForBrush (cairo_t *cr, double *width, double 
*height);
        virtual bool ClipOnHeightAndWidth () { return true; }
 
        virtual FillRule GetFillRule ();
@@ -318,7 +318,6 @@
 
        virtual void Draw (cairo_t *cr);
 
-       virtual void GetSizeForBrush (cairo_t *cr, double *width, double 
*height);
        virtual bool ClipOnHeightAndWidth () { return true; }
 
        virtual bool CanFill () { return true; }

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

Reply via email to