mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:37:45 +00:00
LibGfx: Use llroundf() in Rect<float>::to_rounded()
No need to drag the values through a float-to-double conversion.
This commit is contained in:
parent
fdf1c3c2f1
commit
afebc372b9
1 changed files with 15 additions and 6 deletions
|
@ -700,12 +700,21 @@ public:
|
|||
template<typename U>
|
||||
[[nodiscard]] ALWAYS_INLINE Rect<U> to_rounded() const
|
||||
{
|
||||
return {
|
||||
static_cast<U>(llroundd(x())),
|
||||
static_cast<U>(llroundd(y())),
|
||||
static_cast<U>(llroundd(width())),
|
||||
static_cast<U>(llroundd(height())),
|
||||
};
|
||||
if constexpr (IsSame<T, float>) {
|
||||
return {
|
||||
static_cast<U>(llroundf(x())),
|
||||
static_cast<U>(llroundf(y())),
|
||||
static_cast<U>(llroundf(width())),
|
||||
static_cast<U>(llroundf(height())),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
static_cast<U>(llroundd(x())),
|
||||
static_cast<U>(llroundd(y())),
|
||||
static_cast<U>(llroundd(width())),
|
||||
static_cast<U>(llroundd(height())),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] String to_string() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue