mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
common: Changing the rounded rect starting point
According to the SVG standard, drawing a rectangle starts at (x+rx, y) point. Till now it was (x+w, y+ry). The difference was visible only for dashed strokes.
This commit is contained in:
parent
6ec88ed486
commit
0c602291cb
1 changed files with 5 additions and 5 deletions
|
@ -215,20 +215,20 @@ Result Shape::appendRect(float x, float y, float w, float h, float rx, float ry)
|
|||
pImpl->lineTo(x + w, y + h);
|
||||
pImpl->lineTo(x, y + h);
|
||||
pImpl->close();
|
||||
//circle
|
||||
//rounded rectangle or circle
|
||||
} else {
|
||||
auto hrx = rx * PATH_KAPPA;
|
||||
auto hry = ry * PATH_KAPPA;
|
||||
pImpl->grow(10, 17);
|
||||
pImpl->moveTo(x + w, y + ry);
|
||||
pImpl->moveTo(x + rx, y);
|
||||
pImpl->lineTo(x + w - rx, y);
|
||||
pImpl->cubicTo(x + w - rx + hrx, y, x + w, y + ry - hry, x + w, y + ry);
|
||||
pImpl->lineTo(x + w, y + h - ry);
|
||||
pImpl->cubicTo(x + w, y + h - ry + hry, x + w - rx + hrx, y + h, x + w - rx, y + h);
|
||||
pImpl->lineTo(x + rx, y + h);
|
||||
pImpl->cubicTo(x + rx - hrx, y + h, x, y + h - ry + hry, x, y + h - ry);
|
||||
pImpl->lineTo(x, y + ry);
|
||||
pImpl->cubicTo(x, y + ry - hry, x + rx - hrx, y, x + rx, y);
|
||||
pImpl->lineTo(x + w - rx, y);
|
||||
pImpl->cubicTo(x + w - rx + hrx, y, x + w, y + ry - hry, x + w, y + ry);
|
||||
pImpl->close();
|
||||
}
|
||||
|
||||
|
@ -400,4 +400,4 @@ Result Shape::fill(FillRule r) noexcept
|
|||
FillRule Shape::fillRule() const noexcept
|
||||
{
|
||||
return pImpl->rs.rule;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue