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];
}
}
//! Combine rectangle (x, y, w, h) with this.
-bool wxRegion::Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord 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();
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];
/*