X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9a8864cad79d7021630c5e72f4a8f2d76b6b44d8..6cef0db28018fd2644ee4e38af715872e5242459:/src/mac/carbon/region.cpp diff --git a/src/mac/carbon/region.cpp b/src/mac/carbon/region.cpp index 20d5d46b7d..d08fd4984c 100644 --- a/src/mac/carbon/region.cpp +++ b/src/mac/carbon/region.cpp @@ -33,9 +33,9 @@ public: m_macRgn.reset( HIShapeCreateMutable() ); } - wxRegionRefData(HIShapeRef hRegion) + wxRegionRefData(wxCFRef ®ion) { - m_macRgn.reset( HIShapeCreateMutableCopy(hRegion) ); + m_macRgn.reset( HIShapeCreateMutableCopy(region) ); } wxRegionRefData(long x, long y, long w, long h) @@ -75,7 +75,8 @@ wxRegion::wxRegion() wxRegion::wxRegion(WXHRGN hRegion ) { - m_refData = new wxRegionRefData(hRegion); + wxCFRef< HIShapeRef > shape( (HIShapeRef) hRegion ); + m_refData = new wxRegionRefData(shape); } wxRegion::wxRegion(long x, long y, long w, long h) @@ -100,8 +101,7 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle)) wxUnusedVar(n); wxUnusedVar(points); -#if 0 // ndef __LP64__ - m_refData = new wxRegionRefData; +#ifndef __LP64__ // TODO : any APIs ? // OS X somehow does not collect the region invisibly as before, so sometimes things @@ -137,9 +137,17 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle)) if ( x1 != x2 || y1 != y2 ) ::LineTo( x1, y1 ) ; - CloseRgn( M_REGION ) ; - + RgnHandle tempRgn = NewRgn(); + CloseRgn( tempRgn ) ; + ::SetGWorld( oldWorld, oldGDHandle ); + wxCFRef tempShape( HIShapeCreateWithQDRgn(tempRgn ) ); + m_refData = new wxRegionRefData(tempShape); + DisposeRgn( tempRgn ); + } + else + { + m_refData = new wxRegionRefData; } #else wxFAIL_MSG( "not implemented" ); @@ -152,6 +160,16 @@ wxRegion::~wxRegion() // m_refData unrefed in ~wxObject } +wxGDIRefData *wxRegion::CreateGDIRefData() const +{ + return new wxRegionRefData; +} + +wxGDIRefData *wxRegion::CloneGDIRefData(const wxGDIRefData *data) const +{ + return new wxRegionRefData(*wx_static_cast(const wxRegionRefData *, data)); +} + //----------------------------------------------------------------------------- //# Modify region //-----------------------------------------------------------------------------