Commit graph

8 commits

Author SHA1 Message Date
MacDue
b1a72d66f6 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.
2023-03-11 18:34:26 +00:00
MacDue
223cedc896 LibGfx: Update fill_path() to support taking a PaintStyle
This means fill_path() now paints the scanlines its self rather than
calling draw_line() which easily allows each pixel along the scanline
to have a different color.
2023-01-22 18:15:52 +01:00
Nico Weber
a96f307af1 Everywhere: Make global inline functions not static
`inline` already assigns vague linkage, so there's no need to
also assign per-TU linkage. Allows the linker to dedup these
functions across TUs (and is almost always just the Right Thing
to do in C++ -- this ain't C).
2023-01-04 20:04:57 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
MacDue
40e978df85 LibGfx: Fix some more antialiased line off-by-ones
Turns out most things expect lines to include the endpoint,
e.g. 0,0 -> 3,0 is a 4px long line. But the fill_path() implementation
seems to expect the line to be the distance between the two points
(so the above example is a 3px line instead).

This now adds an option to pick between PointToPoint line length or
Distance line length and uses the latter for fill_path().
2022-12-03 15:36:58 +00:00
MacDue
76de41c3b7 LibGfx: Add draw_line_for_path() and remove AntiAliasPolicy
draw_line_for_path() is the same as the standard antialiased
draw_line() but with a few few small hacks to improve the look of
paths.

AntiAliasPolicy is also removed as it's now unused.
2022-11-26 01:17:04 +01:00
Ali Mohammad Pur
5a2e7d30ce LibWeb: Use Gfx::AntiAliasingPainter to draw SVG paths
This is still quite bad, but it's much more pleasing to look at when
drawing random SVGs :^)
2021-09-18 02:12:38 +04:30
Ali Mohammad Pur
e2cd558101 LibGfx: Start a very basic anti-aliased Painter implementation
This can currently draw AA lines (and by proxy, AA paths), and passes
all its output through a 2D affine transform to an underlying
Gfx::Painter.
2021-09-18 02:12:38 +04:30