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
27fb4a9e00
commit
34a1d1315a
1 changed files with 3 additions and 0 deletions
|
@ -679,6 +679,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;
|
||||
|
@ -719,6 +720,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;
|
||||
|
@ -727,6 +729,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…
Reference in a new issue