/////////////////////////////////////////////////////////////////////////////
// File: region.cpp
// Purpose: Region class
-// Author: Markus Holzem, Julian Smart, Robert Roebling
+// Author: Julian Smart, Robert Roebling
// Created: Fri Oct 24 10:46:34 MET 1997
-// RCS-ID: $Id$
-// Copyright: (c) 1997 Markus Holzem, Julian Smart, Robert Roebling
+// RCS-ID: $Id$
+// Copyright: (c) 1997 Julian Smart, Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "region.h"
#endif
bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
+ // 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 ( !width || !height )
+ return TRUE;
+
XRectangle rect;
rect.x = x;
rect.y = y;
wxRIRefData::~wxRIRefData()
{
- delete m_rects;
+ delete [] m_rects;
}
void wxRIRefData::CreateRects( const wxRegion& region )
{
if (m_rects)
- delete m_rects;
+ delete [] m_rects;
m_rects = 0;
m_numRects = 0;
Region r = (Region) region.GetX11Region();
if (r)
{
+#if wxUSE_NANOX
+ GR_RECT rect;
+ GrGetRegionBox(r, & rect);
+ m_numRects = 1;
+ m_rects = new wxRect[1];
+ m_rects[0].x = rect.x;
+ m_rects[0].y = rect.y;
+ m_rects[0].width = rect.width;
+ m_rects[0].height = rect.height;
+#else
m_numRects = r->numRects;
if (m_numRects)
{
wr.height = xr.y2-xr.y1;
}
}
+#endif
}
}