clamp rx/ry to valid range (<= 0.5*width/0.5*height)
SVG spec : ".. If 'rx' is greater than half of the width of the rectangle, then the user agent must process the 'rect' element with the effective value for 'rx' as half of the width of the rectangle. If 'ry' is greater than half of the height of the rectangle, then the user agent must process the 'rect' element with the effective value for 'ry' as half of the height of the rectangle.."
This commit is contained in:
parent
9af3313063
commit
804115089b
1 changed files with 3 additions and 0 deletions
|
@ -708,6 +708,7 @@ void parse_ellipse(svg_parser & parser, xmlTextReaderPtr reader)
|
|||
|
||||
void parse_rect(svg_parser & parser, xmlTextReaderPtr reader)
|
||||
{
|
||||
// http://www.w3.org/TR/SVGTiny12/shapes.html#RectElement
|
||||
xmlChar *value;
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
|
@ -748,6 +749,7 @@ void parse_rect(svg_parser & parser, xmlTextReaderPtr reader)
|
|||
if (value)
|
||||
{
|
||||
rx = parse_double((const char*)value);
|
||||
if ( rx > 0.5 * w ) rx = 0.5 * w;
|
||||
xmlFree(value);
|
||||
}
|
||||
else rounded = false;
|
||||
|
@ -756,6 +758,7 @@ void parse_rect(svg_parser & parser, xmlTextReaderPtr reader)
|
|||
if (value)
|
||||
{
|
||||
ry = parse_double((const char*)value);
|
||||
if ( ry > 0.5 * h ) ry = 0.5 * h;
|
||||
if (!rounded)
|
||||
{
|
||||
rx = ry;
|
||||
|
|
Loading…
Add table
Reference in a new issue