Author: lewing
Date: 2008-02-07 17:08:48 -0500 (Thu, 07 Feb 2008)
New Revision: 95195

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

        * brush.cpp (GradientBrush::SetupGradient): treat stops > 1.0 the
        same as out of bounds stops.


Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2008-02-07 21:50:15 UTC (rev 95194)
+++ trunk/moon/src/ChangeLog    2008-02-07 22:08:48 UTC (rev 95195)
@@ -9,6 +9,9 @@
 
 2008-02-07  Larry Ewing  <[EMAIL PROTECTED]>
 
+       * brush.cpp (GradientBrush::SetupGradient): treat stops > 1.0 the
+       same as out of bounds stops.
+
        * shape.cpp: cache the results of CompouteShapeBounds in
        extents rect, use that value in GetSizeForBrush.
 

Modified: trunk/moon/src/brush.cpp
===================================================================
--- trunk/moon/src/brush.cpp    2008-02-07 21:50:15 UTC (rev 95194)
+++ trunk/moon/src/brush.cpp    2008-02-07 22:08:48 UTC (rev 95195)
@@ -355,36 +355,36 @@
 
        // negative value are "mostly" ignored, the one nearest to zero may ne 
used
        int n = 0;
-       GradientStop *negative = NULL;
+       GradientStop *out_of_bounds = NULL;
 
        for ( ; node != NULL; node = (Collection::Node *) node->next) {
                GradientStop *stop = (GradientStop *) node->obj;
                double offset = gradient_stop_get_offset (stop);
-               if (offset >= 0.0) {
+               if (offset >= 0.0 && offset <= 1.0) {
                        Color *color = gradient_stop_get_color (stop);
                        cairo_pattern_add_color_stop_rgba (pattern, offset, 
color->r, color->g, color->b, color->a * opacity);
                        n++;
                } else if (n < 2) {
                        // we don't have enough stops so we might need the 
negative one
-                       if (!negative) {
+                       if (!out_of_bounds) {
                                // keep in mind our first stop with a negative 
offset
-                               negative = stop;
+                               out_of_bounds = stop;
                        } else {
                                // keep the stop with the negative offset 
closer to zero
-                               if (offset > gradient_stop_get_offset 
(negative))
-                                       negative = stop;
+                               if (offset > gradient_stop_get_offset 
(out_of_bounds))
+                                       out_of_bounds = stop;
                        }
                } else {
                        // we have at least 2 stops so we don't need to 
consider negative ones
-                       negative = NULL;
+                       out_of_bounds = NULL;
                }
        }
 
        // if the negative stop is required...
-       if (negative && (n < 2)) {
+       if (out_of_bounds && (n < 2)) {
                // add it to the mix
-               double offset = gradient_stop_get_offset (negative);
-               Color *color = gradient_stop_get_color (negative);
+               double offset = gradient_stop_get_offset (out_of_bounds);
+               Color *color = gradient_stop_get_color (out_of_bounds);
                cairo_pattern_add_color_stop_rgba (pattern, offset, color->r, 
color->g, color->b, color->a * opacity);
        }
 }

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

Reply via email to