[cairo-commit] src/cairo-svg-surface.c

Emmanuel Pacaud emmanuel at kemper.freedesktop.org
Thu Mar 8 12:37:16 PST 2007


 src/cairo-svg-surface.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

New commits:
diff-tree 772edc9133d41dfd667ae5915dfa6ace0bcbfd0d (from c07867c545d7ab7c4a104944768f8a5b69ef9596)
Author: Emmanuel Pacaud <emmanuel.pacaud at free.fr>
Date:   Thu Mar 8 21:32:59 2007 +0100

    SVG: fix a radial gradient failure when using CAIRO_EXTEND_REFLECT.
    
    Assume from the beginning we're using a circle with a radius equal to
    2 * ( r1 - r0 ) when emulating CAIRO_EXTEND_REFLECT.

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index fdd4993..5cb9ce0 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1501,23 +1501,23 @@ _cairo_svg_surface_emit_radial_pattern (
 	if ((extend == CAIRO_EXTEND_REFLECT
 	     || extend == CAIRO_EXTEND_REPEAT)
 	    && r0 > 0.0) {
-	    offset = fmod (r1, r1 - r0) / (r1 - r0) - 1.0;
-	    r = r1 - r0;
+	    double r_org = r1;
 
 	    if (extend == CAIRO_EXTEND_REFLECT) {
-		r *= 2.0;
-		offset *= 0.5;
+		r1 = 2 * r1 - r0;
 		emulate_reflect = TRUE;
 	    }
 
+	    offset = fmod (r1, r1 - r0) / (r1 - r0) - 1.0;
+	    r = r1 - r0;
+
 	    /* New position of outer circle. */
-	    x = r * (x1 - fx) / r1 + fx;
-	    y = r * (y1 - fy) / r1 + fy;
+	    x = r * (x1 - fx) / r_org + fx;
+	    y = r * (y1 - fy) / r_org + fy;
 
 	    x1 = x;
 	    y1 = y;
 	    r1 = r;
-
 	    r0 = 0.0;
 	} else {
 	    offset = r0 / r1;


More information about the cairo-commit mailing list