mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:37:44 +00:00
LibGfx: Speed up fill_path() with per scanline clipping & fast fills
This improves fill_path() performance by adding an API to the painter that allows painting an entire scanline rather than just a pixel. With this paths can be clipped a scanline at a time rather than each pixel, removing a fair amount of checks. Along with optimized clipping, this can now use a fast_u32_fill() to paint all but the subpixels of a scanline if a solid color with no alpha channel is used (which is quite common in SVGs). This reduces scrolling around on svg.html from 21% in set_pixel() and 19% in fill_path() to just 7.8% in fill_path (with set_pixel() eliminated). Now fill_path() is far from the slowest code when scrolling the page.
This commit is contained in:
parent
be958a14cf
commit
b1a72d66f6
4 changed files with 81 additions and 23 deletions
|
@ -213,8 +213,7 @@ void AntiAliasingPainter::draw_line(FloatPoint actual_from, FloatPoint actual_to
|
|||
|
||||
void AntiAliasingPainter::fill_path(Path const& path, Color color, Painter::WindingRule rule)
|
||||
{
|
||||
Detail::fill_path<Detail::FillPathMode::AllowFloatingPoints>(
|
||||
m_underlying_painter, path, [=](IntPoint) { return color; }, rule, m_transform.translation());
|
||||
Detail::fill_path<Detail::FillPathMode::AllowFloatingPoints>(m_underlying_painter, path, color, rule, m_transform.translation());
|
||||
}
|
||||
|
||||
void AntiAliasingPainter::fill_path(Path const& path, PaintStyle const& paint_style, Painter::WindingRule rule)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue