diff --git a/Libraries/LibGfx/Rect.h b/Libraries/LibGfx/Rect.h index 37693555d3..d485804a80 100644 --- a/Libraries/LibGfx/Rect.h +++ b/Libraries/LibGfx/Rect.h @@ -364,6 +364,15 @@ public: return !(*this == other); } + Rect operator*(T factor) const { return { m_location * factor, m_size * factor }; } + + Rect& operator*=(T factor) + { + m_location *= factor; + m_size *= factor; + return *this; + } + void intersect(const Rect&); static Rect from_two_points(const Point& a, const Point& b) diff --git a/Libraries/LibGfx/Size.h b/Libraries/LibGfx/Size.h index 09d15db3a4..f91887900d 100644 --- a/Libraries/LibGfx/Size.h +++ b/Libraries/LibGfx/Size.h @@ -98,6 +98,15 @@ public: return *this; } + Size operator*(T factor) const { return { m_width * factor, m_height * factor }; } + + Size& 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();