diff --git a/Libraries/LibGfx/FloatPoint.h b/Libraries/LibGfx/FloatPoint.h index 40d7636df4f..9d929639a34 100644 --- a/Libraries/LibGfx/FloatPoint.h +++ b/Libraries/LibGfx/FloatPoint.h @@ -29,6 +29,7 @@ #include #include #include +#include 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 4b08043db2e..39caf90e035 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 b58a8df84b8..02638e50583 100644 --- a/Libraries/LibGfx/FloatSize.h +++ b/Libraries/LibGfx/FloatSize.h @@ -29,6 +29,7 @@ #include #include #include +#include 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; }