From f594806dd39d73592b88de1e5aa485d304572bb2 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Sat, 9 Dec 2023 18:05:57 +0900 Subject: [PATCH] renderer/shape: Apply the magic number kappa to achieve rounded corners. The magic number kappa (0.552284), which is associated with the bezier curve, has been introduced. This formula is supposed to be applied to the rounded corners of the rectangle to ensure consistent drawing results. Issue: https://github.com/thorvg/thorvg/issues/1824 --- src/renderer/tvgShape.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/tvgShape.cpp b/src/renderer/tvgShape.cpp index ebae44c0..6c1a9470 100644 --- a/src/renderer/tvgShape.cpp +++ b/src/renderer/tvgShape.cpp @@ -219,8 +219,8 @@ Result Shape::appendRect(float x, float y, float w, float h, float rx, float ry) } else if (mathEqual(rx, halfW) && mathEqual(ry, halfH)) { return appendCircle(x + (w * 0.5f), y + (h * 0.5f), rx, ry); } else { - auto hrx = rx * 0.5f; - auto hry = ry * 0.5f; + auto hrx = rx * PATH_KAPPA; + auto hry = ry * PATH_KAPPA; pImpl->grow(10, 17); pImpl->moveTo(x + rx, y); pImpl->lineTo(x + w - rx, y);