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
Notes: sideshowbarker 2024-07-18 09:59:37 +09:00

View File

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