mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-23 17:58:59 +00:00
LibGfx: Add convenience method Point::constrained
This commit is contained in:
parent
790eacfbd1
commit
a43ba348e1
Notes:
sideshowbarker
2024-07-19 03:27:41 +09:00
Author: https://github.com/tomuta
Commit: a43ba348e1
Pull-request: https://github.com/SerenityOS/serenity/pull/2994
Reviewed-by: https://github.com/awesomekling
1 changed files with 7 additions and 1 deletions
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
#include <AK/Forward.h>
|
#include <AK/Forward.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <LibGfx/Orientation.h>
|
|
||||||
#include <LibGfx/Forward.h>
|
#include <LibGfx/Forward.h>
|
||||||
|
#include <LibGfx/Orientation.h>
|
||||||
#include <LibIPC/Forward.h>
|
#include <LibIPC/Forward.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -100,6 +100,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void constrain(const Rect<T>&);
|
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
|
bool operator==(const Point<T>& other) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue