-//! Combine rectangle (x, y, w, h) with this.
-bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
-{
- // 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 );
- }
-
- RgnHandle rgn = NewRgn() ;
- SetRectRgn( rgn , x , y, x + width, y + height ) ;
-
- switch (op)
- {
- case wxRGN_AND:
- SectRgn( M_REGION , rgn , M_REGION ) ;
- break ;
-
- case wxRGN_OR:
- UnionRgn( M_REGION , rgn , M_REGION ) ;
- break ;
-
- case wxRGN_XOR:
- XorRgn( M_REGION , rgn , M_REGION ) ;
- break ;
-
- case wxRGN_DIFF:
- DiffRgn( M_REGION , rgn , M_REGION ) ;
- break ;
-
- case wxRGN_COPY:
- default:
- CopyRgn( rgn , M_REGION ) ;
- break ;
- }
-
- DisposeRgn( rgn ) ;
-
- return true;
-}
-