Skip to content

Commit

Permalink
cairo: exec Rect() if RoundedRect() is called with rx == 0 or ry == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
mpsuzuki committed Dec 19, 2019
1 parent f2ba220 commit 0df194c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions svgnative/ports/cairo/CairoSVGRenderer.cpp
Expand Up @@ -76,6 +76,12 @@ void CairoSVGPath::RoundedRect(float x, float y, float width, float height, floa
// Cairo does not provide single API to draw "rounded rect". See
// https://www.cairographics.org/samples/rounded_rectangle/

if (cornerRadiusX == 0 || cornerRadiusY == 0)
{
Rect(x, y, width, height);
return;
}

cairo_new_sub_path(mPathCtx);

cairo_arc_rx_ry(mPathCtx, x - cornerRadiusX + width, y + cornerRadiusY, cornerRadiusX, cornerRadiusY, deg2rad(-90), deg2rad( 0));
Expand Down

0 comments on commit 0df194c

Please sign in to comment.