diff --git a/Libraries/LibGfx/FloatPoint.h b/Libraries/LibGfx/FloatPoint.h index 40d7636df4f6919c822fe5f76974a494704d5bd4..9d929639a3480fa5c7981069fd7557740c804d19 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 4b08043db2e37915eaaca7f5ff12ba90eeecc612..39caf90e035cf41475d919d6d4c6c2a326768001 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 b58a8df84b8523d42820ade55b6cbf9054bfc47d..02638e50583a0cb5e989dc3643479894ed0f30e4 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; }