From e0a19e354344a8170dfd0f70667796e147b7b2a8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 21 Feb 2026 17:09:42 -0300 Subject: [PATCH] hb-raster: process single-row edges without active-edge list New bucket edges are processed inline for the current row. Only edges that span beyond the current row are added to the active list. This avoids push/remove_unordered churn for the majority of flattened curve segments which typically span only 1-3 pixel rows. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/hb-raster-draw.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/hb-raster-draw.cc b/src/hb-raster-draw.cc index c752717db..8e3dd995d 100644 --- a/src/hb-raster-draw.cc +++ b/src/hb-raster-draw.cc @@ -925,12 +925,19 @@ hb_raster_draw_render (hb_raster_draw_t *draw) int32_t y_top = (ext.y_origin + (int) row) << 6; int32_t py = y_top >> 6; - /* Add new edges from this row's bucket. */ - for (unsigned idx : draw->edge_buckets.arrayZ[row]) - draw->active_edges.push (idx); - - /* Process active edges, removing expired ones. */ + /* Process new edges from this row's bucket. Only add to the + active list if they span beyond this row. */ unsigned x_min = ext.width, x_max = 0; + for (unsigned idx : draw->edge_buckets.arrayZ[row]) + { + const auto &e = draw->edges.arrayZ[idx]; + edge_sweep_row (draw->row_area.arrayZ, draw->row_cover.arrayZ, + ext.width, ext.x_origin, py, e, x_min, x_max); + if (((e.yH - 1) >> 6) > py) + draw->active_edges.push (idx); + } + + /* Process continuing active edges, removing expired ones. */ for (unsigned j = 0; j < draw->active_edges.length; ) { const auto &e = draw->edges.arrayZ[draw->active_edges.arrayZ[j]];