summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibGfx/FloatPoint.h8
-rw-r--r--Libraries/LibGfx/FloatRect.h5
-rw-r--r--Libraries/LibGfx/FloatSize.h6
3 files changed, 19 insertions, 0 deletions
diff --git a/Libraries/LibGfx/FloatPoint.h b/Libraries/LibGfx/FloatPoint.h
index 40d7636df4..9d929639a3 100644
--- a/Libraries/LibGfx/FloatPoint.h
+++ b/Libraries/LibGfx/FloatPoint.h
@@ -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; }
diff --git a/Libraries/LibGfx/FloatRect.h b/Libraries/LibGfx/FloatRect.h
index 4b08043db2..39caf90e03 100644
--- a/Libraries/LibGfx/FloatRect.h
+++ b/Libraries/LibGfx/FloatRect.h
@@ -56,6 +56,11 @@ public:
{
}
+ explicit FloatRect(const Rect& other)
+ : FloatRect((FloatPoint)other.location(), (FloatSize)other.size())
+ {
+ }
+
bool is_null() const
{
return width() == 0 && height() == 0;
diff --git a/Libraries/LibGfx/FloatSize.h b/Libraries/LibGfx/FloatSize.h
index b58a8df84b..02638e5058 100644
--- a/Libraries/LibGfx/FloatSize.h
+++ b/Libraries/LibGfx/FloatSize.h
@@ -29,6 +29,7 @@
#include <AK/LogStream.h>
#include <AK/String.h>
#include <LibGfx/Orientation.h>
+#include <LibGfx/Size.h>
namespace Gfx {
@@ -40,6 +41,11 @@ public:
, m_height(h)
{
}
+ explicit FloatSize(const Size& other)
+ : m_width(other.width())
+ , m_height(other.height())
+ {
+ }
bool is_null() const { return !m_width && !m_height; }
bool is_empty() const { return m_width <= 0 || m_height <= 0; }