From 5bdb58553411a187e4c6bb4d0aecc58a30775977 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 24 Jan 2024 01:38:46 +0900 Subject: [PATCH] sw_engine: Rectified dash line drawing issue. Omit the dash line when its length falls below a minimal threshold. This threshold is set to less than 0.0001 times the pixel size. --- src/renderer/sw_engine/tvgSwShape.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/sw_engine/tvgSwShape.cpp b/src/renderer/sw_engine/tvgSwShape.cpp index 9aa95523..45322c07 100644 --- a/src/renderer/sw_engine/tvgSwShape.cpp +++ b/src/renderer/sw_engine/tvgSwShape.cpp @@ -132,7 +132,7 @@ static void _dashLineTo(SwDashStroke& dash, const Point* to, const Matrix* trans _outlineLineTo(*dash.outline, to, transform); } } else { - while (len > dash.curLen) { + while (len - dash.curLen > 0.0001f) { Line left, right; if (dash.curLen > 0) { len -= dash.curLen; @@ -189,7 +189,7 @@ static void _dashCubicTo(SwDashStroke& dash, const Point* ctrl1, const Point* ct _outlineCubicTo(*dash.outline, ctrl1, ctrl2, to, transform); } } else { - while (len > dash.curLen) { + while ((len - dash.curLen) > 0.0001f) { Bezier left, right; if (dash.curLen > 0) { len -= dash.curLen;