New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rx == 0 or ry == 0 ellipse or rectangle can paralyze Cairo port, at least. #69
Comments
If rx and ry are non-zero, like,
|
But, if rx == 0, like,
The source at abfb9aa gives such result. |
According to https://svgwg.org/svg2-draft/shapes.html#EllipseElement a value of 0 for either rx or ry disables the rendering of the element. Same for r on circle or width/height on rect. So we should skip the element if one of the attributes is 0. |
During the investigation of my patch for Issue #67, I found my cairo port is paralyzed by the ellipse or rectangles with rx == 0 or ry == 0. I think Skia and CoreGraphics ports are safe from this issue, because they have direct functions to draw ellipse or rounded-rectangle.
Cairo has no direct functions to draw ellipse or rounded-rectangle, so I inserted cairo_scale() to stretch the circle or rounded-corner of the rounded rectangle. Maybe, cairo_scale(cr, 0, scale_y) or cairo_scale(cr, scale_x, 0) and following cairo_arc() makes cairo confused, and all following objects are not drawn correctly.
So, I drafted a patch to replace "rx == 0 or ry == 0 ellipse" by a squashed bounding-box, and to replace "rx == 0 or ry == 0 rounded rectangle" by normal rectangle.
Another option might be "if an ellipse or a rounded-rectangle with rx==0 or ry==0, do not take it as a drawable element". I wish if the experts give some comments on the direction we should go.
The text was updated successfully, but these errors were encountered: