patch for bug, id=528808

Florent Monnier <[email protected]>
Newsgroups gmane.comp.gnome.lib.librsvg.devel
Message-ID <[email protected]>
Hi,
Here is attached to this email a patch for this bug
http://bugzilla.gnome.org/show_bug.cgi?id=528808
along with a test file and the result it should output.

The code is the one from this bug report, adapted to rsvg.

the patch is against this version of the file:
http://svn.gnome.org/viewvc/librsvg/trunk/rsvg-cairo-draw.c?view=markup&pathrev=1154

Hope this helps!

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Librsvg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/librsvg-devel
rsvg-cairo-draw.c.patch (text/x-diff, 1.9 KB)
--- rsvg-cairo-draw.c.svn.1154	2008-10-14 21:18:00.000000000 +0200
+++ rsvg-cairo-draw.c	2008-10-14 21:18:11.000000000 +0200
@@ -221,15 +221,38 @@
         current_color_rgb = radial->current_color;
 
     if (radial->obj_bbox)
         _rsvg_push_view_box (ctx, 1., 1.);
 
-    pattern = cairo_pattern_create_radial (_rsvg_css_normalize_length (&radial->fx, ctx, 'h'),
-                                           _rsvg_css_normalize_length (&radial->fy, ctx, 'v'), 0.0,
-                                           _rsvg_css_normalize_length (&radial->cx, ctx, 'h'),
-                                           _rsvg_css_normalize_length (&radial->cy, ctx, 'v'),
-                                           _rsvg_css_normalize_length (&radial->r, ctx, 'o'));
+    {
+        double fx, fy, cx, cy, r;
+        double vx, vy, vlen;
+        fx = _rsvg_css_normalize_length (&radial->fx, ctx, 'h');
+        fy = _rsvg_css_normalize_length (&radial->fy, ctx, 'v');
+        cx = _rsvg_css_normalize_length (&radial->cx, ctx, 'h');
+        cy = _rsvg_css_normalize_length (&radial->cy, ctx, 'v');
+        r = _rsvg_css_normalize_length (&radial->r, ctx, 'o');
+        vx = fx - cx;
+        vy = fy - cy;
+        vlen = sqrt(vx*vx + vy*vy);
+        if (vlen > r) {
+            double angle, px, py;
+            angle = atan2(vy, vx);
+            if ((vx + cx) < cx)
+                px = (cos(angle) * r) + 1.0;
+            else
+                px = (cos(angle) * r) - 1.0;
+            if ((vy + cy) < cy)
+                py = (sin(angle) * r) + 1.0;
+            else
+                py = (sin(angle) * r) - 1.0;
+
+            fx = cx + px;
+            fy = cy + py;
+        }
+        pattern = cairo_pattern_create_radial (fx, fy, 0.0, cx, cy, r);
+    }
     if (radial->obj_bbox)
         _rsvg_pop_view_box (ctx);
 
     cairo_matrix_init (&matrix,
                        radial->affine[0], radial->affine[1],
test-radial.png (image/png, 9.7 KB) - not displayed
test-radial.svg (image/svg+xml, 1013 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.