mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 02:08:12 +03:00
LibGfx: Make enclosing_int_rect(FloatRect) actually enclose the rect
This commit is contained in:
parent
c59c970363
commit
e0a79efeae
Notes:
sideshowbarker
2024-07-18 09:59:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e0a79efeaea
@ -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 });
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user