summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx/FloatPoint.h
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGfx/FloatPoint.h')
-rw-r--r--Libraries/LibGfx/FloatPoint.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/Libraries/LibGfx/FloatPoint.h b/Libraries/LibGfx/FloatPoint.h
index 766197d967..9867d8327d 100644
--- a/Libraries/LibGfx/FloatPoint.h
+++ b/Libraries/LibGfx/FloatPoint.h
@@ -37,7 +37,7 @@ class FloatRect;
class FloatPoint {
public:
- FloatPoint() {}
+ FloatPoint() { }
FloatPoint(float x, float y)
: m_x(x)
, m_y(y)
@@ -112,6 +112,13 @@ public:
}
FloatPoint operator+(const FloatPoint& other) const { return { m_x + other.m_x, m_y + other.m_y }; }
+ FloatPoint& operator/=(float factor)
+ {
+ m_x /= factor;
+ m_y /= factor;
+ return *this;
+ }
+
String to_string() const { return String::format("[%g,%g]", x(), y()); }
bool is_null() const { return !m_x && !m_y; }