Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / Usermode / Applications / axwin4_src / Server / CRect.cpp
index 5d603e5..acbcc27 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <CRect.hpp>
 #include <algorithm>
+#include <acess/sys.h>
 
 namespace AxWin {
 
@@ -17,6 +18,23 @@ CRect::CRect(int x, int y, unsigned int w, unsigned int h):
 {
 }
 
+void CRect::Move(int NewX, int NewY)
+{
+       // TODO: Add a parent rectangle, and prevent this from fully leaving its bounds
+       m_x = NewX;
+       m_y = NewY;
+       m_x2 = m_x + m_w;
+       m_y2 = m_y + m_h;
+}
+
+void CRect::Resize(int NewW, int NewH)
+{
+       m_w = NewW;
+       m_h = NewH;
+       m_x2 = m_x + m_w;
+       m_y2 = m_y + m_h;
+}
+
 bool CRect::HasIntersection(const CRect& other) const
 {
        // If other's origin is past our far corner
@@ -40,10 +58,10 @@ CRect CRect::Intersection(const CRect& other) const
        int x2 = ::std::min(m_x2, other.m_x2);
        int y2 = ::std::min(m_y2, other.m_y2);
        
-       if( x1 <= x2 || y2 <= y1 )
+       if( x2 <= x1 || y2 <= y1 )
                return CRect();
        
-       return CRect(x1, y1, x2-x1, y2-y2);
+       return CRect(x1, y1, x2-x1, y2-y1);
 }
 
 CRect CRect::RelativeIntersection(const CRect& area)

UCC git Repository :: git.ucc.asn.au