- // TODO create m_rects and fill with rectangles for this region
-
- // For now, fudge by getting the whole bounding box.
- m_rects = new wxRect[1];
- m_numRects = 1;
- m_rects[0] = m_region.GetBox();
+ // Create m_rects and fill with rectangles for this region.
+ // Since we can't find the rectangles in a region, we cheat
+ // by retrieving the rectangles explicitly set in wxPaintDC::wxPaintDC
+ // (dcclient.cpp).
+ if (m_region.UsingRects())
+ {
+ wxRect* rects = m_region.GetRects();
+ int count = m_region.GetRectCount();
+ m_numRects = count;
+ m_rects = new wxRect[m_numRects];
+
+ for (size_t i = 0; i < m_numRects; i++)
+ m_rects[i] = rects[i];
+
+ /*
+ int i = 0;
+ wxRectList::Node* node = rectList.GetFirst();
+ while (node) {
+ wxRect* rect = node->GetData();
+ m_rects[i] = * rect;
+ node = node->GetNext();
+ i ++;
+ }
+ */
+ }
+ else
+ {
+ // For now, fudge by getting the whole bounding box.
+ m_rects = new wxRect[1];
+ m_numRects = 1;
+ m_rects[0] = m_region.GetBox();
+ }