From 772edc9133d41dfd667ae5915dfa6ace0bcbfd0d Mon Sep 17 00:00:00 2001 From: Emmanuel Pacaud Date: Thu, 8 Mar 2007 21:32:59 +0100 Subject: 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. --- src/cairo-svg-surface.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c index fdd49932..5cb9ce0b 100644 --- a/src/cairo-svg-surface.c +++ b/src/cairo-svg-surface.c @@ -1501,23 +1501,23 @@ _cairo_svg_surface_emit_radial_pattern (cairo_svg_surface_t *surface, 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; -- cgit v1.2.3