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:
parent
c59c970363
commit
e0a79efeae
1 changed files with 5 additions and 6 deletions
|
@ -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 });
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue