Skip to content

feat(svm): draw a curve as a curve, not as a line through its control points - #791

Merged
andiwand merged 1 commit into
mainfrom
feat/svm-beziers
Aug 30, 2026
Merged

feat(svm): draw a curve as a curve, not as a line through its control points#791
andiwand merged 1 commit into
mainfrom
feat/svm-beziers

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Stage 9 of #772, closing the last of its ten defects, stacked on #790
#789#788#787#786#785#784#779review those first; this
branch's base is feat/svm-map-mode.

A polygon that carries curves is written twice: first its corners alone,
then again as Polygon::Read writes it — VersionCompat, the points, and one
PolyFlags per point. We read the flag byte that says the second one follows,
dropped it, and drew the first. Every curve therefore came out as a line
through what were its control points.

PolyFlags::Control marks a control point, three in a row are one bezier
segment, and that is an svg C. A poly-polygon says the same thing through its
"complex polygons": each names by index the polygon it replaces with the same
shape, curves included — also read and dropped until now.

The polygon a shape is made of therefore carries its flags now, which is what
svgwriter.cxx's GetPathString walks too.

Checked against LibreOffice

For a metafile written by hand with one flagged polygon, LibreOffice's own
export writes

M 100,700 C 300,100 700,100 900,700

and so do we, character for character.

Nothing in the corpus moves

Not one of the 1125 metafiles harvested from the fixtures carries a polygon
flag or a complex poly-polygon, so no reference output changes and there is no
pin bump. The 3 new tests (47 in the svm suite) are inline bytes: a polyline
with flags curves, the same polyline without them is lines, and a complex
poly-polygon replaces its polygon.

What is left after this

svm/PLAN.md names it: WALLPAPER, FLOATTRANSPARENT and EPS, which all
nest something of their own; the MASK family; MOVECLIPREGION;
ZCOMPRESSed bitmaps; and version-1 (pre-VCLMTF) files. None of them occurs
in the corpus, and each is logged where it is skipped.

Base automatically changed from feat/svm-map-mode to main August 30, 2026 18:31
… points

Closes the last of #772's defects. A polygon that carries curves is written
twice: first its corners alone, then again as `Polygon::Read` writes it, with
one `PolyFlags` per point. We read the flag byte that says the second one
follows, dropped it, and drew the first - so every curve came out as a line
through what were its control points.

`PolyFlags::Control` marks a control point and three in a row are one bezier
segment, which is an svg `C`. A poly-polygon says the same thing through its
"complex polygons": each names by index the polygon it replaces with the same
shape, curves included.

The polygon a shape is made of therefore carries its flags now, which is what
`svgwriter.cxx`'s `GetPathString` walks too.

For the same polygon LibreOffice writes `M 100,700 C 300,100 700,100 900,700`,
and so do we. Nothing in the corpus draws a curve - not one of the 1125
metafiles harvested from the fixtures carries a flag - so no rendering moves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CmCr22NW6wPQKiQidk96bq
@andiwand
andiwand merged commit cd2907b into main Aug 30, 2026
29 checks passed
@andiwand
andiwand deleted the feat/svm-beziers branch August 30, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant