mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
renderer: fix trimmed stroke blinking
Bug introduced as part of a7e7bbc
.
After recalculating begin and end to the 0-1 range, an extra
check was added to handle cases when begin is very close to end.
However, this was a bad approach since, even for very close values,
their relationship remains important. What should have been
done in the mentioned commit is properly handling the case
begin == end, which was incorrectly treated as trimming from begin
to end. Instead, it should be handled as trimming from begin to
1.0 and from 0.0 to end.
@Issue: https://github.com/thorvg/thorvg/issues/3204
This commit is contained in:
parent
cc4c18d6c6
commit
3ed357e17a
1 changed files with 1 additions and 4 deletions
|
@ -240,10 +240,7 @@ static void _trim(const PathCommand* inCmds, uint32_t inCmdsCnt, const Point* in
|
|||
auto trimStart = begin * totalLength;
|
||||
auto trimEnd = end * totalLength;
|
||||
|
||||
if (fabsf(begin - end) < EPSILON) {
|
||||
_trimPath(inCmds, inCmdsCnt, inPts, inPtsCnt, trimStart, totalLength, out);
|
||||
_trimPath(inCmds, inCmdsCnt, inPts, inPtsCnt, 0.0f, trimStart, out, connect);
|
||||
} else if (begin > end) {
|
||||
if (begin >= end) {
|
||||
_trimPath(inCmds, inCmdsCnt, inPts, inPtsCnt, trimStart, totalLength, out);
|
||||
_trimPath(inCmds, inCmdsCnt, inPts, inPtsCnt, 0.0f, trimEnd, out, connect);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue