mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 19:19:44 +03:00
LibGfx: Floor draw origin in fill path implementation
This is done to be consistent with enclosing_int_rect() which is used elsewhere to work out offsets in PaintStyles. Without this, you can get an off-by-one in painting.
This commit is contained in:
parent
78aad28dba
commit
ef58062f71
Notes:
sideshowbarker
2024-07-17 01:23:08 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/ef58062f71 Pull-request: https://github.com/SerenityOS/serenity/pull/18212 Reviewed-by: https://github.com/Lubrsi Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/linusg
@ -117,7 +117,8 @@ void Painter::fill_path_impl(Path const& path, ColorOrFunction color, Gfx::Paint
|
||||
|
||||
auto draw_scanline = [&](int y, GridCoordinateType x1, GridCoordinateType x2) {
|
||||
const auto draw_offset = offset.value_or({ 0, 0 });
|
||||
const auto draw_origin = (path.bounding_box().top_left() + draw_offset).to_type<int>();
|
||||
// Note: .to_floored() is used here to be consistent with enclosing_int_rect()
|
||||
const auto draw_origin = (path.bounding_box().top_left() + draw_offset).to_floored<int>();
|
||||
// FIMXE: Offset is added here to handle floating point translations in the AA painter,
|
||||
// really this should be done there but this function is a bit too specialised.
|
||||
y = floorf(y + draw_offset.y());
|
||||
|
Loading…
Reference in New Issue
Block a user