- // Don't change shared data
- if (!m_refData) {
- m_refData = new wxRegionRefData();
- } else if (m_refData->GetRefCount() > 1) {
- wxRegionRefData* ref = (wxRegionRefData*)m_refData;
- UnRef();
- m_refData = new wxRegionRefData(*ref);
- }
- // If ref count is 1, that means it's 'ours' anyway so no action.
-
- HRGN rectRegion = ::CreateRectRgn(x, y, x + width, y + height);
-
- int mode = 0;
- switch (op)
+ const HRGN hrgn = GetHrgn();
+ wxCHECK_MSG( hrgn, false, wxT("invalid wxRegion") );
+
+ if ( !x && !y )