1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

LibGfx: Allow constructing Float{Rect,Point,Size} from integer buddies

This commit is contained in:
Andreas Kling 2020-04-12 19:16:27 +02:00
parent dd7796515f
commit 5c780c9ef7
3 changed files with 19 additions and 0 deletions

View file

@ -29,6 +29,7 @@
#include <AK/LogStream.h>
#include <AK/String.h>
#include <LibGfx/Orientation.h>
#include <LibGfx/Point.h>
namespace Gfx {
@ -42,6 +43,13 @@ public:
, m_y(y)
{
}
explicit FloatPoint(const Point& other)
: m_x(other.x())
, m_y(other.y())
{
}
float x() const { return m_x; }
float y() const { return m_y; }