+ RGNRECT vRgnData;
+ PRECTL pRect;
+
+ if (::GpiQueryRegionRects( ((wxRegionRefData*)rRegion.m_refData)->m_hPS // Pres space
+ ,((wxRegionRefData*)rRegion.m_refData)->m_hRegion // Handle of region to query
+ ,NULL // Return all RECTs
+ ,&vRgnData // Will contain number or RECTs in region
+ ,NULL // NULL to return number of RECTs
+ ))
+ {
+ pRect = new RECTL[vRgnData.crcReturned];
+ m_pRects = new wxRect[vRgnData.crcReturned];
+ vRgnData.crc = vRgnData.crcReturned;
+ m_lNumRects = vRgnData.crcReturned;
+ vRgnData.ircStart = 1;
+ if (::GpiQueryRegionRects( ((wxRegionRefData*)rRegion.m_refData)->m_hPS // Pres space of source
+ ,((wxRegionRefData*)rRegion.m_refData)->m_hRegion // Handle of source region
+ ,NULL // Return all RECTs
+ ,&vRgnData // Operations set to return rects
+ ,pRect // Will contain the actual RECTS
+ ))
+ {
+ M_REGION = ::GpiCreateRegion( ((wxRegionRefData*)rRegion.m_refData)->m_hPS
+ ,vRgnData.crcReturned
+ ,pRect
+ );
+ for( LONG i = 0; i < m_lNumRects; i++)
+ {
+ m_pRects[i].x = pRect[i].xLeft;
+ m_pRects[i].width = pRect[i].xRight - pRect[i].xLeft;
+ m_pRects[i].y = pRect[i].yBottom;
+ m_pRects[i].height = pRect[i].yTop - pRect[i].yBottom;
+ }
+ ((wxRegionRefData*)m_refData)->m_hPS = ((wxRegionRefData*)rRegion.m_refData)->m_hPS;
+ }
+ }