svgreader.cxx: XML_RECT question

Marco Cecchetti mrcekets at
Sat Apr 28 05:39:37 PDT 2012

On Sat, 28 Apr 2012 00:35:26 +0200, Marco Cecchetti <mrcekets at>  

> On Fri, 27 Apr 2012 23:03:41 +0200, Christina Roßmanith  
> <ChrRossmanith at> wrote:
>> Hi,
>> there are two "case XML_RECT" blocks in svgreader.cxx in two different  
>> visitors. The ShapeWritingVisitor scales rx and ry with width and  
>> height, the ShapeRenderingVisitor does not apply any scaling. I guess  
>> both visitors should treat rx and ry the same way?
> Looking at basegfx::tools::createPolygonFromRect implementation
> (in basegfx/source/polygon/b2dpoligontools.cxx) the routine expects
> radii (rx, ry) in the [0,1] range and if not they are cropped
> to 0 or 1. So the scaled input should be the correct one.
> However I think it is better if you perform some visual test.

Well, I have thought again to createPolygonFromRect implementation,
because I had the feeling I had missed something.
If rx is the radius how could the value 1 be a valid input ?
In fact rx/width == 1 => rx == width, but the corner radius along
the x-axis should be <= width/2.

These lines from the createPolygonFromRect implementation:

     const double fBowX((rRect.getWidth() / 2.0) * fRadiusX);
     const double fBowY((rRect.getHeight() / 2.0) * fRadiusY);

confirmed to me that the rx argument is required to be a fraction
of width/2 and the ry argument to be a fraction of height/2.

So the XML_RECT case implementation is wrong in the
ShapeWritingVisitor, too. The passed radii have to be:
rx / (width/2) and ry / (height/2).

In fact, by opening the attached svg file with Inkscape
(or in a browser) and in Draw you can see that corner
rounding is different.

Btw I have no idea which user action the ShapeRenderingVisitor
is triggered by.

-- Marco

Using Opera's revolutionary e-mail client:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rounded_rect.svg
Type: image/svg+xml
Size: 1819 bytes
Desc: not available
URL: <>

More information about the LibreOffice mailing list