- GdkRectangle rect;
- rect.x = x;
- rect.y = y;
- rect.width = width;
- rect.height = height;
- GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
- gdk_region_destroy( M_REGIONDATA->m_region );
- M_REGIONDATA->m_region = reg;
- M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
- return TRUE;
+ return m_refData != region.m_refData;
+}
+
+void wxRegion::Clear()
+{
+ UnRef();
+}
+
+bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+{
+ GdkRectangle rect;
+ rect.x = x;
+ rect.y = y;
+ rect.width = width;
+ rect.height = height;
+ if (!m_refData)
+ {
+ m_refData = new wxRegionRefData();
+ GdkRegion *reg = gdk_region_new();
+ M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
+ gdk_region_destroy( reg );
+ }
+ else
+ {
+ GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
+ gdk_region_destroy( M_REGIONDATA->m_region );
+ M_REGIONDATA->m_region = reg;
+ }
+
+ M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
+
+ return TRUE;