Commit Graph
15641 Commits
Author SHA1 Message Date
Behdad Esfahbod 1c44fd9981 raster: use hb_memset in core hot paths 2026-02-24 05:16:42 -03:00
Behdad Esfahbod 383aae52f9 raster: expand top-level docs and usage guidance 2026-02-24 05:08:09 -03:00
Behdad Esfahbod bcd19a4c39 raster: add draw/paint scale-factor API 2026-02-24 05:02:35 -03:00
Behdad Esfahbod 70f45cbdcd raster-draw: hardwire output format to A8 2026-02-24 04:52:44 -03:00
Behdad Esfahbod 5ea04afcda raster: adopt create_or_fail and strict render semantics 2026-02-24 04:46:51 -03:00
Behdad Esfahbod 420fe6ef70 raster: rename helper header to hb-raster-utils.hh 2026-02-24 04:29:07 -03:00
Behdad Esfahbod bf9b2c86ad raster: split image internals into private header 2026-02-24 04:26:52 -03:00
Behdad Esfahbod 0727834314 raster-image: consolidate configuration API 2026-02-24 04:22:51 -03:00
Behdad Esfahbod c173b39b6a raster-image: move image ops into methods 2026-02-24 04:03:43 -03:00
Behdad Esfahbod 7ffc215001 [buffer] Add a missing immutable check 2026-02-24 04:00:48 -03:00
Behdad Esfahbod 3f59dce67f raster-paint: reuse mask clip buffers across push/pop 2026-02-24 03:40:12 -03:00
Behdad Esfahbod 395a620666 raster-paint: keep caches across reset 2026-02-24 03:37:07 -03:00
Behdad Esfahbod 22d102b24e raster-paint: reuse gradient stop scratch buffer 2026-02-24 03:35:29 -03:00
Behdad Esfahbod f02a1d1a32 raster-paint: gate gradient LUT by clip area and hoist branch 2026-02-24 03:31:05 -03:00
Behdad Esfahbod 7e53502728 raster-paint: add 256-entry gradient LUT sampling
Speeds up at large sizes mostly.
2026-02-24 03:18:39 -03:00
Behdad Esfahbod 0960825994 raster-paint: speed up masked paint_color compositing 2026-02-24 02:58:18 -03:00
Behdad Esfahbod 4653e22a91 raster-paint: compose clip glyph mask in mapped tight extents (~50% faster) 2026-02-24 02:45:05 -03:00
Behdad Esfahbod b37a92f361 [CFF2] Use a safe direct array access 2026-02-24 02:26:59 -03:00
Behdad Esfahbod 7c5e300751 [CFF2] Slight rename of stack 2026-02-24 02:25:55 -03:00
Behdad Esfahbod c2757c0d93 raster: make cubic de Casteljau flattener iterative 2026-02-24 02:19:19 -03:00
Behdad Esfahbod c2fe10f1f3 raster: make quadratic de Casteljau flattener iterative 2026-02-24 02:15:46 -03:00
Behdad Esfahbod ab4092abd2 raster: annotate sweep_row_to_alpha pointers restrict 2026-02-24 01:52:41 -03:00
Behdad Esfahbod e0c03c0f65 raster: speed up clip glyph mask composition 2026-02-24 01:17:37 -03:00
Behdad Esfahbod be6011b7a6 raster-paint: incrementally step affine coords in paint loops 2026-02-24 00:53:12 -03:00
Behdad Esfahbod 3eabfde47a raster-paint: tighten push_clip_glyph intersection loops 2026-02-24 00:48:55 -03:00
Behdad Esfahbod b7969504bc Revert "raster-paint: use bounded clip masks and clipped group compositing"
This reverts commit 7f707557d3.
2026-02-24 00:42:54 -03:00
Behdad Esfahbod 7f707557d3 raster-paint: use bounded clip masks and clipped group compositing 2026-02-24 00:38:04 -03:00
Behdad Esfahbod 1659d27a48 Revert "raster-paint: reuse clip stack storage via logical top"
This reverts commit 473f69f555.

There was no speedup, so keep the simpler code.
2026-02-24 00:10:44 -03:00
Behdad Esfahbod 473f69f555 raster-paint: reuse clip stack storage via logical top 2026-02-24 00:10:11 -03:00
Behdad Esfahbod 332e1afcb5 raster-paint: inline private paint structs into .cc 2026-02-24 00:05:30 -03:00
Behdad Esfahbod 12b5a9ec89 [raster-paint] ALWAYS_INLINE 2026-02-24 00:01:34 -03:00
Behdad Esfahbod 6bfdaabc8a raster-paint: specialize rect clip hot loops 2026-02-23 23:48:18 -03:00
Behdad Esfahbod 46782abcaa [raster] Micro-optimize 2026-02-23 23:28:59 -03:00
Behdad EsfahbodandClaude Opus 4.6 d7d17ee055 raster: fix winding carry for edges left of the surface
When an edge fell to the left of the rendering surface (col < 0),
cell_add() discarded its winding contribution entirely.  For glyphs
whose outlines extend beyond the surface bounds (e.g. COLR v1
spliceMask clip glyphs), this caused the interior winding number to
stay zero, producing empty rasterizations.

Fix by forwarding the cover delta to column 0 so the left-to-right
sweep picks up the correct accumulated winding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 22:31:24 -03:00
Behdad Esfahbod 1350d2a470 [cmap] Fix CodeXL warning
Fixes https://github.com/harfbuzz/harfbuzz/issues/5753
2026-02-23 18:44:50 -03:00
Behdad Esfahbod 742f79da08 raster: remove extents_from_glyph_extents API
Remove hb_raster_extents_from_glyph_extents and switch callers to the new transform-aware set_glyph_extents APIs on raster draw/paint. Also add test coverage for transformed glyph extents and update section symbol listings.
2026-02-23 12:10:41 -03:00
Behdad Esfahbod dc532931d6 raster: streamline scanline hot paths 2026-02-22 19:26:42 -03:00
Behdad Esfahbod 5f4319400b [raster-draw] Combine two passes
20% speedup. Devised by codex.
2026-02-22 19:20:34 -03:00
Behdad Esfahbod d6be64a89b [raster] Remove duplicate documentation block
https://github.com/harfbuzz/harfbuzz/pull/5749#pullrequestreview-3838613326
2026-02-22 18:59:06 -03:00
Behdad Esfahbod 85ea4f92cf raster: match FreeType quadratic recursive flatness criterion
This is also slower than what we have, but produces much closer
results to FreeType.
2026-02-22 18:18:39 -03:00
Behdad Esfahbod 07c82109c4 raster: match FreeType cubic recursive flatness criterion
This is slightly slower, but matches FreeType rasterization for OTF
fonts much better.
2026-02-22 18:13:41 -03:00
Behdad Esfahbod 603ea5e1f2 raster-paint: require explicit extents and add helper 2026-02-22 15:18:40 -03:00
Behdad Esfahbod 830c097d09 raster-paint: clear internal render state between calls 2026-02-22 15:03:39 -03:00
Behdad Esfahbod 9683497463 Revert "raster: fix seam at shared contour endpoints via row splitting"
This reverts commit 6f4ad84ce5d6a69260c03b7dfc727a09dbe0a6dc.
2026-02-22 14:21:09 -03:00
Behdad EsfahbodandClaude Opus 4.6 8788d49250 raster: fix seam at shared contour endpoints via row splitting
Pre-compute seam rows during edge bucketing where one edge's yH matches
another edge's yL at a mid-pixel-row y-coordinate. For these rare rows
(typically 2 per glyph), split into two sub-rows and sum absolute alpha
values to avoid winding cancellation. Non-seam rows take the exact same
code path with only a single branch check overhead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:21:09 -03:00
Behdad Esfahbod e66df7ac66 Revert "raster: fix seam at shared contour endpoints by splitting row"
This reverts commit af884ced9e76b630178a338584031b5ae127d95a.
2026-02-22 14:21:09 -03:00
Behdad EsfahbodandClaude Opus 4.6 cff6be61b9 raster: fix seam at shared contour endpoints by splitting row
When two contours share a y coordinate that falls mid-pixel-row,
their edges contribute opposite-winding cover values at different
fractional heights.  The analytic formula |cover·512 − area|
computes the signed sum, which partially cancels, producing a
visible one-row artifact.

Fix by detecting these seam rows (an edge yH matching another
edge's yL within the same pixel row) and splitting into sub-rows.
Each sub-row's |cover·512 − area| is computed independently, then
the absolute alpha values are summed.  This gives correct coverage
because each sub-row has consistent winding direction.

Performance impact is negligible: seam detection piggybacks on the
existing edge-removal loop (zero cost for non-seam rows), and
sub-row processing only runs for the rare seam rows (typically 1-2
per glyph).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:21:09 -03:00
Behdad EsfahbodandClaude Opus 4.6 174a2f3b3d raster: fix sweep gradient angle mapping and REFLECT extend mode
Two bugs fixed:
- atan2f returns [-pi,pi] but sweep gradient angles are in [0,2*pi];
  normalize pixel angle to [0,2*pi) so the seam matches the OT spec.
- REFLECT extend mode was identical to REPEAT because floorf after
  the initial mod made period always 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 02:05:06 -03:00
Behdad EsfahbodandClaude Opus 4.6 a544ff5d6d raster: fix clip rectangle for non-axis-aligned transforms
When the current transform has rotation/skew, push_clip_rectangle now
rasterizes the actual transformed quad using edge cross-product tests
instead of approximating with an axis-aligned bounding box.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:40:45 -03:00
Behdad EsfahbodandClaude Opus 4.6 63d7a12963 raster: optimize paint loops to skip transparent clip regions
Track bounding box (min_x/y, max_x/y) on all clip masks. Paint
callbacks (solid fill, image, gradients) now iterate only within
the clip bounding box instead of the full surface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:39:29 -03:00