1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:17:34 +00:00

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.
This commit is contained in:
MacDue 2023-01-15 22:15:24 +00:00 committed by Andreas Kling
parent b31d768e95
commit 223cedc896
5 changed files with 64 additions and 29 deletions

View file

@ -2373,7 +2373,16 @@ void Painter::stroke_path(Path const& path, Color color, int thickness)
void Painter::fill_path(Path const& path, Color color, WindingRule winding_rule)
{
VERIFY(scale() == 1); // FIXME: Add scaling support.
Detail::fill_path<Detail::FillPathMode::PlaceOnIntGrid>(*this, path, color, winding_rule);
Detail::fill_path<Detail::FillPathMode::PlaceOnIntGrid>(
*this, path, [=](IntPoint) { return color; }, winding_rule);
}
void Painter::fill_path(Path const& path, PaintStyle const& paint_style, Painter::WindingRule rule)
{
VERIFY(scale() == 1); // FIXME: Add scaling support.
paint_style.paint(enclosing_int_rect(path.bounding_box()), [&](PaintStyle::SamplerFunction sampler) {
Detail::fill_path<Detail::FillPathMode::PlaceOnIntGrid>(*this, path, move(sampler), rule);
});
}
void Painter::blit_disabled(IntPoint location, Gfx::Bitmap const& bitmap, IntRect const& rect, Palette const& palette)