Files
figcraft/docs
Denis Gomes a28dca47b5 M1: A curved layer's outline bends smoothly
The hover and selection outline of an ellipse, a vector or a rounded
corner is the layer's path flattened into lines on screen. The lines
could be 0.5 pt from the curve, which made the outline of a 65 by 50
ellipse turn by up to 22 degrees at each point at 100%, and showed its
straight pieces at every zoom. The fill, drawn by the renderer, stayed
smooth under it.

The flattening tolerance is now 0.02 pt on screen for a path with up to
200 curved segments, so the outline stays within a fiftieth of a point
of the curve. Above that it grows with the count, up to the old 0.5 pt
at 5,000 curves. The hover outline is flattened every frame and the
selection outline every frame the view moves, and egui tessellates
every point each frame: at a flat 0.02 pt a vector of 5,000 curves had
about 4.7 times the points and took about 5 to 9 ms more per frame in a
release build (perf_tests harness, frame plus tessellation). Caching
the flattened points alone would not have helped much, since the
tessellation runs every frame anyway.

The test checks how far the outline strays from the curve, which is
what the tolerance controls. The sharpest turn per step depends on how
large the curve is on screen, so a fixed angle was close to the edge.
2026-11-19 16:36:58 -05:00
..