Author: lewing
Date: 2007-11-08 15:55:43 -0500 (Thu, 08 Nov 2007)
New Revision: 89252

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/shape.cpp
Log:
    2007-11-08 Larry Ewing <[EMAIL PROTECTED]>

        * src/shape.cpp: always clip to the width/height regardless of the
        fill type.  Verified against tests.


Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-11-08 20:52:46 UTC (rev 89251)
+++ trunk/moon/src/ChangeLog    2007-11-08 20:55:43 UTC (rev 89252)
@@ -1,3 +1,8 @@
+2007-11-08  Larry Ewing  <[EMAIL PROTECTED]>
+
+       * shape.cpp: always clip to the framework element width/height
+       regardless of the Fill, verified against test cases.
+
 2007-11-08  Chris Toshok  <[EMAIL PROTECTED]>
 
        [ may go a long way toward fixing #337714, if it doesn't fix it

Modified: trunk/moon/src/shape.cpp
===================================================================
--- trunk/moon/src/shape.cpp    2007-11-08 20:52:46 UTC (rev 89251)
+++ trunk/moon/src/shape.cpp    2007-11-08 20:55:43 UTC (rev 89252)
@@ -150,8 +150,8 @@
 
        bool drawn = false;
 
-       // we need to use clipping to implement StretchUniformToFill
-       if (!IsDegenerate () && (shape_get_stretch (this) == 
StretchUniformToFill)) {
+       // we need to use clipping to implement the various Fills
+       if (!IsDegenerate ()) {
                double w = framework_element_get_width (this);
                if (w > 0.0) {
                        double h = framework_element_get_height (this);
@@ -1611,44 +1611,19 @@
 
        bounds = geometry->ComputeBounds (this);
 
-       Stretch stretch = shape_get_stretch (this);
-       if (stretch != StretchNone) {
-               double t = shape_get_stroke_thickness (this) * .5;
-               bounds.x = -t;
-               bounds.y = -t;
-
-               Value *vh = GetValueNoDefault 
(FrameworkElement::HeightProperty);
-               double vscale = 1.0;
-               if (vh)
-                       vscale = vh->AsDouble () / bounds.h;
-
-               Value *vw = GetValueNoDefault (FrameworkElement::WidthProperty);
-               double hscale = 1.0;
-               if (vw)
-                       hscale = vw->AsDouble () / bounds.w;
-               
-               double scale; 
-
-               switch (stretch) {
-               case StretchUniform:
-                       scale = MIN (vw ? vscale : hscale, vh ? hscale : 
vscale);
-                       bounds.h = (int) ceil(bounds.h * scale);
-                       bounds.w = (int) ceil(bounds.w * scale);
-                       break;
-               case StretchUniformToFill:
-                       scale = MAX (vw ? vscale : hscale, vh ? hscale : 
vscale);
-                       bounds.h = (int) ceil(bounds.h * scale);
-                       bounds.w = (int) ceil(bounds.w * scale);
-                       break;
-               default:
-                       // bounds are already set correctly
-                       bounds.h = bounds.h * vscale;
-                       bounds.w = bounds.w * hscale;
-                       break;
-               }
-
-               bounds.w += 2 * t;
-               bounds.h += 2 * t;
+       Value *vh = GetValueNoDefault (FrameworkElement::HeightProperty);
+       double vscale = 1.0;
+       if (vh)
+               bounds.h = vh->AsDouble ();
+       
+       Value *vw = GetValueNoDefault (FrameworkElement::WidthProperty);
+       double hscale = 1.0;
+       if (vw)
+               bounds.w = vw->AsDouble ();
+                      
+       if ((!vh && vw) || (!vw && vh) ||  bounds.w == 0 || bounds.h == 0) {
+               bounds = Rect (0, 0, 0, 0);
+               return;
        }
 
        bounds = bounding_rect_for_transformed_rect (&absolute_xform,

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

Reply via email to