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

LibGfx: Make enclosing_int_rect(FloatRect) actually enclose the rect

This commit is contained in:
Andreas Kling 2021-07-09 15:18:49 +02:00
parent c59c970363
commit e0a79efeae

View file

@ -612,12 +612,11 @@ using FloatRect = Rect<float>;
[[nodiscard]] ALWAYS_INLINE IntRect enclosing_int_rect(FloatRect const& float_rect) [[nodiscard]] ALWAYS_INLINE IntRect enclosing_int_rect(FloatRect const& float_rect)
{ {
return { int x1 = floorf(float_rect.x());
(int)float_rect.x(), int y1 = floorf(float_rect.y());
(int)float_rect.y(), int x2 = ceilf(float_rect.x() + float_rect.width());
(int)ceilf(float_rect.width()), int y2 = ceilf(float_rect.y() + float_rect.height());
(int)ceilf(float_rect.height()), return Gfx::IntRect::from_two_points({ x1, y1 }, { x2, y2 });
};
} }
} }