X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..4b8f49129801403f12a3b840077841d268b080f9:/src/motif/region.cpp diff --git a/src/motif/region.cpp b/src/motif/region.cpp index 57a0343e3a..6417ac967e 100644 --- a/src/motif/region.cpp +++ b/src/motif/region.cpp @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // File: region.cpp // Purpose: Region class -// Author: Markus Holzem/Julian Smart +// Author: Julian Smart // Created: Fri Oct 24 10:46:34 MET 1997 -// RCS-ID: $Id$ -// Copyright: (c) 1997 Markus Holzem/Julian Smart +// RCS-ID: $Id$ +// Copyright: (c) 1997 Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -82,10 +82,10 @@ public: void wxRegionRefData::SetRects(const wxRectList& rectList) { DeleteRects(); - m_usingRects = (rectList.Number() > 0); + m_usingRects = (rectList.GetCount() > 0); if (m_usingRects) { - m_rectCount = rectList.Number(); + m_rectCount = rectList.GetCount(); m_rects = new wxRect[m_rectCount]; } @@ -137,7 +137,7 @@ wxRegion::wxRegion() { } -wxRegion::wxRegion(long x, long y, long w, long h) +wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h) { m_refData = new wxRegionRefData; @@ -200,8 +200,17 @@ void wxRegion::Clear() } //! Combine rectangle (x, y, w, h) with this. -bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op) +bool +wxRegion::Combine(wxCoord x, wxCoord y, + wxCoord width, wxCoord height, + wxRegionOp op) { + // work around for XUnionRectWithRegion() bug: taking a union with an empty + // rect results in an empty region (at least XFree 3.3.6 and 4.0 have this + // problem) + if ( op == wxRGN_OR && (!width || !height) ) + return TRUE; + // Don't change shared data if (!m_refData) { m_refData = new wxRegionRefData(); @@ -294,7 +303,7 @@ bool wxRegion::Combine(const wxRect& rect, wxRegionOp op) //----------------------------------------------------------------------------- // Outer bounds of region -void wxRegion::GetBox(long& x, long& y, long&w, long &h) const +void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const { if (m_refData) { XRectangle rect; @@ -310,7 +319,7 @@ void wxRegion::GetBox(long& x, long& y, long&w, long &h) const wxRect wxRegion::GetBox() const { - long x, y, w, h; + wxCoord x, y, w, h; GetBox(x, y, w, h); return wxRect(x, y, w, h); } @@ -326,7 +335,7 @@ bool wxRegion::Empty() const //----------------------------------------------------------------------------- // Does the region contain the point (x,y)? -wxRegionContain wxRegion::Contains(long WXUNUSED(x), long WXUNUSED(y)) const +wxRegionContain wxRegion::Contains(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) const { if (!m_refData) return wxOutRegion; @@ -347,7 +356,7 @@ wxRegionContain wxRegion::Contains(const wxPoint& pt) const } // Does the region contain the rectangle (x, y, w, h)? -wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const +wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const { if (!m_refData) return wxOutRegion; @@ -365,7 +374,7 @@ wxRegionContain wxRegion::Contains(const wxRect& rect) const if (!m_refData) return wxOutRegion; - long x, y, w, h; + wxCoord x, y, w, h; x = rect.x; y = rect.y; w = rect.GetWidth(); @@ -462,8 +471,7 @@ void wxRegionIterator::Reset(const wxRegion& region) m_numRects = count; m_rects = new wxRect[m_numRects]; - int i = 0; - for (i = 0; i < m_numRects; i++) + for (size_t i = 0; i < m_numRects; i++) m_rects[i] = rects[i]; /* @@ -507,28 +515,28 @@ void wxRegionIterator::operator ++ (int) ++m_current; } -long wxRegionIterator::GetX() const +wxCoord wxRegionIterator::GetX() const { if (m_current < m_numRects) return m_rects[m_current].x; return 0; } -long wxRegionIterator::GetY() const +wxCoord wxRegionIterator::GetY() const { if (m_current < m_numRects) return m_rects[m_current].y; return 0; } -long wxRegionIterator::GetW() const +wxCoord wxRegionIterator::GetW() const { if (m_current < m_numRects) return m_rects[m_current].width ; return 0; } -long wxRegionIterator::GetH() const +wxCoord wxRegionIterator::GetH() const { if (m_current < m_numRects) return m_rects[m_current].height;