+ wxDELETEA(m_rects);
+ m_numRects = 0;
+
+ GdkRegion *gdkregion = region.GetRegion();
+ if (!gdkregion)
+ return;
+
+ GdkRectangle *gdkrects = NULL;
+ gint numRects = 0;
+ gdk_region_get_rectangles( gdkregion, &gdkrects, &numRects );
+
+ m_numRects = numRects;
+ if (numRects)
+ {
+ m_rects = new wxRect[m_numRects];
+ for (size_t i=0; i < m_numRects; ++i)
+ {
+ GdkRectangle &gr = gdkrects[i];
+ wxRect &wr = m_rects[i];
+ wr.x = gr.x;
+ wr.y = gr.y;
+ wr.width = gr.width;
+ wr.height = gr.height;
+ }
+ }
+ g_free( gdkrects );
+}
+
+void wxRegionIterator::Reset( const wxRegion& region )
+{
+ m_region = region;
+ CreateRects(region);
+ Reset();