mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-17 06:52:23 +00:00
LibGfx: Give Size and Rect * and *= operators
This commit is contained in:
parent
b67eed5b80
commit
573d5b7ff2
Notes:
sideshowbarker
2024-07-19 00:45:39 +09:00
Author: https://github.com/nico
Commit: 573d5b7ff2
Pull-request: https://github.com/SerenityOS/serenity/pull/4454
2 changed files with 18 additions and 0 deletions
|
@ -364,6 +364,15 @@ public:
|
|||
return !(*this == other);
|
||||
}
|
||||
|
||||
Rect<T> operator*(T factor) const { return { m_location * factor, m_size * factor }; }
|
||||
|
||||
Rect<T>& operator*=(T factor)
|
||||
{
|
||||
m_location *= factor;
|
||||
m_size *= factor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void intersect(const Rect<T>&);
|
||||
|
||||
static Rect<T> from_two_points(const Point<T>& a, const Point<T>& b)
|
||||
|
|
|
@ -98,6 +98,15 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
Size<T> operator*(T factor) const { return { m_width * factor, m_height * factor }; }
|
||||
|
||||
Size<T>& operator*=(T factor)
|
||||
{
|
||||
m_width *= factor;
|
||||
m_height *= factor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T primary_size_for_orientation(Orientation orientation) const
|
||||
{
|
||||
return orientation == Orientation::Vertical ? height() : width();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue