diff options
author | Tom <tomut@yahoo.com> | 2020-08-05 05:10:56 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-18 12:12:27 +0200 |
commit | a43ba348e17a07e006543e14ff9189aef457b288 (patch) | |
tree | 399c0240ef1a8dbba621eb5a1252800b34161143 /Libraries/LibGfx/Point.h | |
parent | 790eacfbd1b2c928299cf9dceabcc632ca4a7aa7 (diff) | |
download | serenity-a43ba348e17a07e006543e14ff9189aef457b288.zip |
LibGfx: Add convenience method Point::constrained
Diffstat (limited to 'Libraries/LibGfx/Point.h')
-rw-r--r-- | Libraries/LibGfx/Point.h | 8 |
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 { |