Hi,

in createPolygonFromRect the interval [0,1] is scaled to [width/2,height/2]. Hence rx and ry have to be divided by width/2 and height/2 respectively - I totally agree with Marco (cf. Re: svgreader.cxx: XML_RECT question).

The attached rounded_rect.svg tests the case that rx=width/2 and ry=height/2 which should be rendered as an ellipse.

Christina
>From aef35520a80a7660c51bbe4a8faf40951abddb86 Mon Sep 17 00:00:00 2001
From: "Chr. Rossmanith" <[email protected]>
Date: Sat, 28 Apr 2012 19:41:35 +0200
Subject: [PATCH] Correct handling of corner radii of rectangles

---
 filter/source/svg/svgreader.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx
index f6dc668..23794a7 100644
--- a/filter/source/svg/svgreader.cxx
+++ b/filter/source/svg/svgreader.cxx
@@ -1335,7 +1335,7 @@ struct ShapeWritingVisitor
                 basegfx::B2DPolygon aPoly;
                 aPoly = basegfx::tools::createPolygonFromRect(
                     basegfx::B2DRange(x,y,x+width,y+height),
-                    rx/width, ry/height );
+                    rx/(0.5*width), ry/(0.5*height) );
 
                 writePathShape(xAttrs,
                                xUnoAttrs,
@@ -2179,7 +2179,7 @@ struct ShapeRenderingVisitor
                 basegfx::B2DPolygon aPoly;
                 aPoly = basegfx::tools::createPolygonFromRect(
                     basegfx::B2DRange(x,y,x+width,y+height),
-                    rx, ry );
+                    rx/(0.5*width), ry/(0.5*height) );
 
                 renderPathShape(basegfx::B2DPolyPolygon(aPoly));
                 break;
-- 
1.7.9.5

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to