Commit graph

7 commits

Author SHA1 Message Date
MacDue
ec93973158 LibGfx: Sprinkle some FLATTEN/hot attributes in the path rasterizer
This seems to actually improve performance to the tune of about +5 fps.
2024-01-08 09:26:43 +01:00
MacDue
e2152a5b3d LibGfx: Clip path rasterizer scanlines sooner
This moves the clipping from per-pixel/draw command to a step before
the main drawing/plotting loop.
2024-01-08 09:26:43 +01:00
MacDue
096bdb142b LibGfx: Speed up filling solid colors in path rasterizer
For solid color fills (with alpha = 255), the rasterizer now tracks
spans of solid colors within a scanline and fills the entire span with
a single call to fast_u32_fill().

This gave up to a 1.5x speedup drawing the Ghostscript Tiger within
SerenityOS.
2024-01-03 12:56:01 +01:00
MacDue
64411127cb LibGfx: Clip edges above or below the visible area in the rasterizer
This avoids doing pointless plotting for scanlines that will never be
seen.

Note: This currently can only clip edges vertically. Horizontal clipping
is more tricky, since edges that are not visible can still change how
things accumulate across the scanline.

Fixes #22382

Sadly, this causes a bunch of LibWeb test churn as this change
imperceptibly changes the final rasterized output.
2023-12-24 13:25:40 +01:00
MacDue
2a914a7a59 LibGfx: Track edge extent in EdgeFlagPathRasterizer
This allows avoiding accumulating values we know will be zero, this is
not a huge speedup but does shave off a few %.
2023-08-06 16:24:28 +02:00
MacDue
eb4a58528e LibWeb+LibGfx: Allow filling with a paint style and opacity 2023-06-11 16:15:56 +02:00
MacDue
48fa8f97d3 LibGfx: Implement new antialiased filled path rasterizer
This is an implementation of the scanline edge-flag algorithm for
antialiased path filling described here:
https://mlab.taik.fi/~kkallio/antialiasing/EdgeFlagAA.pdf

The initial implementation does not try to implement every possible
optimization in favour of keeping things simple. However, it does
support:

   - Both evenodd and nonzero fill rules
   - Applying paint styles/gradients
   - A range of samples per pixel (8, 16, 32)
   - Very nice antialiasing :^)

This replaces the previous path filling code, that only really applied
antialiasing in the x-axis.

There's some very nice improvements around the web with this change,
especially for small icons. Strokes are still a bit wonky, as they don't
yet use this rasterizer, but I think it should be possible to convert
them to do so.
2023-06-01 06:25:00 +02:00