feat(svm): draw the primitives, an arc as an arc - #788
Merged
Conversation
This was referenced Aug 30, 2026
andiwand
force-pushed
the
feat/svm-clipping
branch
from
August 30, 2026 10:00
0cfb5fd to
b6a19a3
Compare
`LINE`, `ELLIPSE`, `ROUNDRECT`, `ARC`, `PIE`, `CHORD`, `POINT` and `PIXEL` were all skipped. The lines matter most: they are what rules a table drawn as a metafile, and two documents in the fixtures had their tables come out as floating numbers with no grid at all. `svgwriter.cxx` turns an arc into a polygon of up to 256 points because it has nothing better; svg has `A`, so the arc goes out as an arc. The geometry is `ImplPolygon`'s: centre and radii from the rectangle, each ray's ellipse parameter `atan2(radius_x·sin θ, radius_y·cos θ)` over the angle θ to the point, and vcl sweeps the mathematically positive way round - counter-clockwise on screen, which is svg's sweep flag 0. A start ray equal to the end one is the whole ellipse rather than nothing, and svg draws nothing for an arc that ends where it starts, so every arc is written as its two halves. Checked against LibreOffice on a metafile written for the purpose: for the same action it puts the arc's ends at (441,544) and (100,650), and so do we; the pie closes through the centre and the chord straight back, as it does. A `POINT` and a `PIXEL` are one device pixel, which no length in the drawing can be. Both go out as a dot of the hairline's own width - a degenerate path with a round cap - rather than the zero-length `<line>` `svgwriter.cxx` writes, which draws nothing at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmCr22NW6wPQKiQidk96bq
andiwand
force-pushed
the
feat/svm-primitives
branch
from
August 30, 2026 17:55
8edc2ad to
eec0439
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
Stage 6 of #772, stacked on #787 → #786 → #785 → #784 → #779 — review those
first; this branch's base is
feat/svm-clipping.LINE,ELLIPSE,ROUNDRECT,ARC,PIE,CHORD,POINTandPIXELwereall skipped. Seven of the eight occur nowhere in the 1125 harvested metafiles —
but
LINEoccurs 47 times in two of them, and it turns out to be what rulesa table:
odt/style+svm-various-2.odtandodt/style+charset+svm-various-1.odthad their tables come out as floatingnumbers with no grid at all. Those two pages are the only reference output this
branch moves.
An arc is svg's
A, not a polygonsvgwriter.cxxturns an arc into a polygon of up to 256 points because it hasnothing better. svg has
A.The geometry is
ImplPolygon's (tools/source/generic/poly.cxx): centre andradii from the rectangle, each ray's ellipse parameter
atan2(radius_x·sin θ, radius_y·cos θ)over the angle θ to the point, and vclsweeps the mathematically positive way round — counter-clockwise on screen,
which is svg's sweep flag 0. A start ray equal to the end ray is the whole
ellipse rather than nothing (
#i73608#), and since svg draws nothing for anarc that ends where it starts, every arc goes out as its two halves.
Checked against LibreOffice on a metafile written for the purpose:
cx=300 cy=250 rx=200 ry=150rx=60 ry=40A point is one device pixel
…which no length in the drawing can be, since the drawing scales. Both
POINTand
PIXELgo out as a dot of the hairline's own width — a degenerate pathwith a round cap — rather than the zero-length
<line>svgwriter.cxxwrites,which draws nothing at all. A
PIXELcarries its own colour, and nothing elsedraws with it.
Verification
5 new tests (34 in the svm suite), the arc one asserting the exact path against
the numbers LibreOffice produced above. Reference output regenerated (2 private
files, no public ones) and the pin advanced here.