mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
renderer/shape: fixed a regression bug
the bug was introduced in 9bf8bb018d
.
Migrated the circle commands to the rectangle, which is currently necessary.
Retained the previous circle commands for backward compatibility.
This commit is contained in:
parent
5d9f8c36a2
commit
4675b25d9a
1 changed files with 13 additions and 3 deletions
|
@ -130,11 +130,11 @@ Result Shape::appendCircle(float cx, float cy, float rx, float ry) noexcept
|
||||||
auto ryKappa = ry * PATH_KAPPA;
|
auto ryKappa = ry * PATH_KAPPA;
|
||||||
|
|
||||||
pImpl->grow(6, 13);
|
pImpl->grow(6, 13);
|
||||||
pImpl->moveTo(cx + rx, cy);
|
pImpl->moveTo(cx, cy - ry);
|
||||||
|
pImpl->cubicTo(cx + rxKappa, cy - ry, cx + rx, cy - ryKappa, cx + rx, cy);
|
||||||
pImpl->cubicTo(cx + rx, cy + ryKappa, cx + rxKappa, cy + ry, cx, cy + ry);
|
pImpl->cubicTo(cx + rx, cy + ryKappa, cx + rxKappa, cy + ry, cx, cy + ry);
|
||||||
pImpl->cubicTo(cx - rxKappa, cy + ry, cx - rx, cy + ryKappa, cx - rx, cy);
|
pImpl->cubicTo(cx - rxKappa, cy + ry, cx - rx, cy + ryKappa, cx - rx, cy);
|
||||||
pImpl->cubicTo(cx - rx, cy - ryKappa, cx - rxKappa, cy - ry, cx, cy - ry);
|
pImpl->cubicTo(cx - rx, cy - ryKappa, cx - rxKappa, cy - ry, cx, cy - ry);
|
||||||
pImpl->cubicTo(cx + rxKappa, cy - ry, cx + rx, cy - ryKappa, cx + rx, cy);
|
|
||||||
pImpl->close();
|
pImpl->close();
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
|
@ -217,7 +217,17 @@ Result Shape::appendRect(float x, float y, float w, float h, float rx, float ry)
|
||||||
pImpl->close();
|
pImpl->close();
|
||||||
//circle
|
//circle
|
||||||
} else if (mathEqual(rx, halfW) && mathEqual(ry, halfH)) {
|
} else if (mathEqual(rx, halfW) && mathEqual(ry, halfH)) {
|
||||||
return appendCircle(x + (w * 0.5f), y + (h * 0.5f), rx, ry);
|
auto rxKappa = rx * PATH_KAPPA;
|
||||||
|
auto ryKappa = ry * PATH_KAPPA;
|
||||||
|
auto cx = x + (w * 0.5f);
|
||||||
|
auto cy = y + (h * 0.5f);
|
||||||
|
pImpl->grow(6, 13);
|
||||||
|
pImpl->moveTo(cx + rx, cy);
|
||||||
|
pImpl->cubicTo(cx + rx, cy + ryKappa, cx + rxKappa, cy + ry, cx, cy + ry);
|
||||||
|
pImpl->cubicTo(cx - rxKappa, cy + ry, cx - rx, cy + ryKappa, cx - rx, cy);
|
||||||
|
pImpl->cubicTo(cx - rx, cy - ryKappa, cx - rxKappa, cy - ry, cx, cy - ry);
|
||||||
|
pImpl->cubicTo(cx + rxKappa, cy - ry, cx + rx, cy - ryKappa, cx + rx, cy);
|
||||||
|
pImpl->close();
|
||||||
} else {
|
} else {
|
||||||
auto hrx = rx * PATH_KAPPA;
|
auto hrx = rx * PATH_KAPPA;
|
||||||
auto hry = ry * PATH_KAPPA;
|
auto hry = ry * PATH_KAPPA;
|
||||||
|
|
Loading…
Add table
Reference in a new issue