Commit 44d4d93
committed
[asimage] Make the two ellipse fill spans mirror each other
asim_ellips2() fills a tilted ellipse by scanline rather than by flood fill:
each iteration of the walk emits two horizontal spans, one on the row above the
centre and one on the row below, exploiting the shape's 180-degree rotational
symmetry. The two spans must therefore be mirror images about the centre, and
they were not. The upper span ended at x2-1 while the lower one started at
x-x2-1, which mirrors to x2+1 -- a two-column disagreement that went in both
directions at once.
Two columns end up unpainted inside the shape on the upper rows, and two
columns outside it get painted on the lower rows. The gap is visible for every
tilted angle and grows with the tilt; at 45 degrees with rx=21, ry=9 it leaves
eight unfilled pixels in the interior, including the one the report points at.
The straight cases are unaffected because angles of 0, 90, 180 and 270 return
early to asim_straight_ellips().
Naming the span end makes the symmetry explicit and lets each branch of the
walk set it from its own geometry. Only the line > yr branch needs a different
value: it writes the anti-aliased outline at x2+2, so the fill may reach x2+1.
The other two branches keep the previous end, so their output does not change.
Measured against the interior of the shape's own outline, over 610 combinations
of angle and radii: unfilled interior pixels drop from 7698 to 30 and painted
exterior pixels from 7496 to 1102, with no combination getting worse on either
count. Unfilled ellipses and the straight-ellipse path render bit-identically
before and after, at every angle and radius tried.
The four filled-ellipse tests were parked in a WILLFAIL target while the fill
was broken; with the spans mirrored they pass, and a passing WILLFAIL test is
reported as a failure, so they move back into tasimage_draw.cxx and the
separate target goes away. tasimage_ellipse_draw.cxx was a strict subset of
tasimage_draw.cxx, so it is removed rather than left to run the same four
tests twice.
Refs #23120
Assisted-by: Claude (Anthropic); the change was AI-assisted, then reviewed,
measured and verified by the author.1 parent 6cfe829 commit 44d4d93
4 files changed
Lines changed: 11 additions & 127 deletions
File tree
- builtins/libAfterImage
- graf2d/asimage/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1523 | 1523 | | |
1524 | 1524 | | |
1525 | 1525 | | |
| 1526 | + | |
1526 | 1527 | | |
1527 | 1528 | | |
1528 | 1529 | | |
| |||
1634 | 1635 | | |
1635 | 1636 | | |
1636 | 1637 | | |
| 1638 | + | |
1637 | 1639 | | |
1638 | 1640 | | |
1639 | 1641 | | |
| |||
1699 | 1701 | | |
1700 | 1702 | | |
1701 | 1703 | | |
1702 | | - | |
1703 | | - | |
| 1704 | + | |
| 1705 | + | |
1704 | 1706 | | |
1705 | 1707 | | |
1706 | 1708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | 184 | | |
181 | | - | |
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
187 | | - | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| |||
194 | 196 | | |
195 | 197 | | |
196 | 198 | | |
197 | | - | |
| |||
This file was deleted.
0 commit comments