mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
LibGfx: Allow comparing Points, Sizes, and Rects of different type
This commit is contained in:
parent
67cda61b7f
commit
7278ff6605
3 changed files with 15 additions and 9 deletions
|
@ -107,12 +107,14 @@ public:
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const Point<T>& other) const
|
template<class U>
|
||||||
|
bool operator==(const Point<U>& other) const
|
||||||
{
|
{
|
||||||
return m_x == other.m_x && m_y == other.m_y;
|
return x() == other.x() && y() == other.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Point<T>& other) const
|
template<class U>
|
||||||
|
bool operator!=(const Point<U>& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,12 +354,14 @@ public:
|
||||||
|
|
||||||
Vector<Rect<T>, 4> shatter(const Rect<T>& hammer) const;
|
Vector<Rect<T>, 4> shatter(const Rect<T>& hammer) const;
|
||||||
|
|
||||||
bool operator==(const Rect<T>& other) const
|
template<class U>
|
||||||
|
bool operator==(const Rect<U>& other) const
|
||||||
{
|
{
|
||||||
return m_location == other.m_location && m_size == other.m_size;
|
return location() == other.location() && size() == other.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Rect<T>& other) const
|
template<class U>
|
||||||
|
bool operator!=(const Rect<U>& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,14 @@ public:
|
||||||
return other.m_width <= m_width && other.m_height <= m_height;
|
return other.m_width <= m_width && other.m_height <= m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const Size<T>& other) const
|
template<class U>
|
||||||
|
bool operator==(const Size<U>& other) const
|
||||||
{
|
{
|
||||||
return m_width == other.m_width && m_height == other.m_height;
|
return width() == other.width() && height() == other.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Size<T>& other) const
|
template<class U>
|
||||||
|
bool operator!=(const Size<U>& other) const
|
||||||
{
|
{
|
||||||
return !(*this == other);
|
return !(*this == other);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue