summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx/Point.h
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-08-05 05:10:56 -0600
committerAndreas Kling <kling@serenityos.org>2020-08-18 12:12:27 +0200
commita43ba348e17a07e006543e14ff9189aef457b288 (patch)
tree399c0240ef1a8dbba621eb5a1252800b34161143 /Libraries/LibGfx/Point.h
parent790eacfbd1b2c928299cf9dceabcc632ca4a7aa7 (diff)
downloadserenity-a43ba348e17a07e006543e14ff9189aef457b288.zip
LibGfx: Add convenience method Point::constrained
Diffstat (limited to 'Libraries/LibGfx/Point.h')
-rw-r--r--Libraries/LibGfx/Point.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/Libraries/LibGfx/Point.h b/Libraries/LibGfx/Point.h
index 9603625ef8..6357b9d2b7 100644
--- a/Libraries/LibGfx/Point.h
+++ b/Libraries/LibGfx/Point.h
@@ -28,8 +28,8 @@
#include <AK/Forward.h>
#include <AK/StdLibExtras.h>
-#include <LibGfx/Orientation.h>
#include <LibGfx/Forward.h>
+#include <LibGfx/Orientation.h>
#include <LibIPC/Forward.h>
#include <math.h>
#include <stdlib.h>
@@ -100,6 +100,12 @@ public:
}
void constrain(const Rect<T>&);
+ Point<T> constrained(const Rect<T>& rect) const
+ {
+ Point<T> point = *this;
+ point.constrain(rect);
+ return point;
+ }
bool operator==(const Point<T>& other) const
{