memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.15k stars 770 forks source link

Fix comparison in nvg__flattenPaths() #669

Closed mkupchik closed 6 months ago

mkupchik commented 6 months ago

A check if (cache->npaths > 0) on function entry does not make sense given the loop for (j = 0; j < cache->npaths; j++) below. If an entry check passes, then loop will never make at least one iteration. Fix initial check which appears to be an optimization for the case when there are no cached paths.

memononen commented 6 months ago

Your fix is not correct. The check is there to see if the path is already tessellated (can happen e.g. calling fill multiple times).

On Tue, Mar 12, 2024 at 7:28 PM Mikhail Kupchik @.***> wrote:

A check if (cache->npaths > 0) on function entry does not make sense given the loop for (j = 0; j < cache->npaths; j++) below. If an entry check passes, then loop will never make at least one iteration. Fix initial check which appears to be an optimization for the case when there are no cached paths.

You can view, comment on, or merge this pull request online at:

https://github.com/memononen/nanovg/pull/669 Commit Summary

File Changes

(1 file https://github.com/memononen/nanovg/pull/669/files)

Patch Links:

— Reply to this email directly, view it on GitHub https://github.com/memononen/nanovg/pull/669, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIBXSACM33BYGHXY547XQDYX43NDAVCNFSM6AAAAABESVWXFSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4DEMRXGI2TGMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>