Implement/match rest of MxSmkPresenter (#345)

* Implement/match rest of MxSmkPresenter

* Fix include guard

* Update mxregion.cpp

* Match MxRegion::VTable0x18

* Fix

* Fix matches

* Remove class name
This commit is contained in:
Christian Semmler
2023-12-21 10:52:42 -05:00
committed by GitHub
parent 20a9a2b4c3
commit 71ed20bf11
14 changed files with 239 additions and 58 deletions

View File

@@ -18,10 +18,10 @@ public:
MxRect32(const MxPoint32& p_point, const MxSize32& p_size)
{
this->m_left = p_point.m_x;
this->m_top = p_point.m_y;
this->m_right = p_size.m_width;
this->m_bottom = p_size.m_height;
this->m_left = p_point.GetX();
this->m_top = p_point.GetY();
this->m_right = p_size.GetWidth();
this->m_bottom = p_size.GetHeight();
}
MxRect32(const MxRect32& p_a, const MxRect32& p_b)
@@ -32,22 +32,40 @@ public:
m_bottom = Min(p_a.m_bottom, p_b.m_bottom);
}
MxRect32(const MxRect32& p_rect) { CopyFrom(p_rect); }
MxRect32& operator=(const MxRect32& p_rect)
{
CopyFrom(p_rect);
return *this;
}
inline void Intersect(const MxRect32& p_rect)
{
m_left = Max(p_rect.m_left, m_left);
m_top = Max(p_rect.m_top, m_top);
m_right = Min(p_rect.m_right, m_right);
m_bottom = Min(p_rect.m_bottom, m_bottom);
}
inline void SetPoint(const MxPoint32& p_point)
{
this->m_left = p_point.m_x;
this->m_top = p_point.m_y;
this->m_left = p_point.GetX();
this->m_top = p_point.GetY();
}
inline void AddPoint(const MxPoint32& p_point)
{
this->m_left += p_point.GetX();
this->m_top += p_point.GetY();
this->m_right += p_point.GetX();
this->m_bottom += p_point.GetY();
}
inline void SetSize(const MxSize32& p_size)
{
this->m_right = p_size.m_width;
this->m_bottom = p_size.m_height;
}
inline MxBool IsValid() { return m_left < m_right && m_top < m_bottom; }
inline MxBool IntersectsWith(const MxRect32& p_rect)
{
return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom;
this->m_right = p_size.GetWidth();
this->m_bottom = p_size.GetHeight();
}
inline void UpdateBounds(const MxRect32& p_rect)
@@ -58,16 +76,22 @@ public:
m_bottom = Max(m_bottom, p_rect.m_bottom);
}
inline MxS32 GetWidth() { return (m_right - m_left) + 1; }
inline MxS32 GetHeight() { return (m_bottom - m_top) + 1; }
inline MxBool IsValid() const { return m_left < m_right && m_top < m_bottom; }
inline MxBool IntersectsWith(const MxRect32& p_rect) const
{
return m_left < p_rect.m_right && p_rect.m_left < m_right && m_top < p_rect.m_bottom && p_rect.m_top < m_bottom;
}
inline MxPoint32 GetPoint() { return MxPoint32(this->m_left, this->m_top); }
inline MxSize32 GetSize() { return MxSize32(this->m_right, this->m_bottom); }
inline MxS32 GetWidth() const { return (m_right - m_left) + 1; }
inline MxS32 GetHeight() const { return (m_bottom - m_top) + 1; }
inline MxS32 GetLeft() { return m_left; }
inline MxS32 GetTop() { return m_top; }
inline MxS32 GetRight() { return m_right; }
inline MxS32 GetBottom() { return m_bottom; }
inline MxPoint32 GetPoint() const { return MxPoint32(this->m_left, this->m_top); }
inline MxSize32 GetSize() const { return MxSize32(this->m_right, this->m_bottom); }
inline MxS32 GetLeft() const { return m_left; }
inline MxS32 GetTop() const { return m_top; }
inline MxS32 GetRight() const { return m_right; }
inline MxS32 GetBottom() const { return m_bottom; }
inline void SetLeft(MxS32 p_left) { m_left = p_left; }
inline void SetTop(MxS32 p_top) { m_top = p_top; }
@@ -75,6 +99,14 @@ public:
inline void SetBottom(MxS32 p_bottom) { m_bottom = p_bottom; }
private:
inline void CopyFrom(const MxRect32& p_rect)
{
this->m_left = p_rect.m_left;
this->m_top = p_rect.m_top;
this->m_right = p_rect.m_right;
this->m_bottom = p_rect.m_bottom;
}
inline static MxS32 Min(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_a : p_b; };
inline static MxS32 Max(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_b : p_a; };