Skip to content

Commit 9204d3c

Browse files
committed
Fix adaptive AA vertical edge detection
The previous implementation incorrectly checked 'dx == 0' to detect vertical edges, but dx is modified by Bresenham reduction. This caused diagonal lines with integer slopes to incorrectly use the vertical optimization, resulting in thin diagonal strokes disappearing.
1 parent 29e40e5 commit 9204d3c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/poly.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,15 @@ static void _twin_edge_fill(twin_pixmap_t *pixmap,
383383
* Only apply to spans >= 16 pixels to avoid branch overhead.
384384
* Threshold: 16 pixels * 4 samples/pixel = 64 samples
385385
*
386-
* Check if both edges forming this span are vertical (dx=0).
386+
* Check aa_quality (not dx) to detect vertical edges.
387+
* By this point, dx has been reduced by Bresenham, so dx==0
388+
* incorrectly matches diagonal lines with integer slopes, causing
389+
* thin diagonal strokes to disappear. The aa_quality flag was set
390+
* using the ORIGINAL dx value before Bresenham reduction.
387391
*/
388392
twin_sfixed_t span_width = a->x - x0;
389-
if (edge_start && edge_start->dx == 0 && a->dx == 0 &&
393+
if (edge_start && edge_start->aa_quality == 0 &&
394+
a->aa_quality == 0 &&
390395
span_width >= (16 << TWIN_POLY_FIXED_SHIFT)) {
391396
/* Both edges vertical and span is wide enough: use optimized
392397
* span fill */

0 commit comments

Comments
 (0)