making ref counting behavior consistent, activating QD variante for polygon region creation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-12-14 17:26:17 +00:00
parent 1ecd8ca468
commit fb4760547d

View File

@@ -33,9 +33,9 @@ public:
m_macRgn.reset( HIShapeCreateMutable() ); m_macRgn.reset( HIShapeCreateMutable() );
} }
wxRegionRefData(HIShapeRef hRegion) wxRegionRefData(wxCFRef<HIShapeRef> &region)
{ {
m_macRgn.reset( HIShapeCreateMutableCopy(hRegion) ); m_macRgn.reset( HIShapeCreateMutableCopy(region) );
} }
wxRegionRefData(long x, long y, long w, long h) wxRegionRefData(long x, long y, long w, long h)
@@ -75,7 +75,8 @@ wxRegion::wxRegion()
wxRegion::wxRegion(WXHRGN hRegion ) 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) 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(n);
wxUnusedVar(points); wxUnusedVar(points);
#if 0 // ndef __LP64__ #ifndef __LP64__
m_refData = new wxRegionRefData;
// TODO : any APIs ? // TODO : any APIs ?
// OS X somehow does not collect the region invisibly as before, so sometimes things // 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 ) if ( x1 != x2 || y1 != y2 )
::LineTo( x1, y1 ) ; ::LineTo( x1, y1 ) ;
CloseRgn( M_REGION ) ; RgnHandle tempRgn = NewRgn();
CloseRgn( tempRgn ) ;
::SetGWorld( oldWorld, oldGDHandle ); ::SetGWorld( oldWorld, oldGDHandle );
wxCFRef<HIShapeRef> tempShape( HIShapeCreateWithQDRgn(tempRgn ) );
m_refData = new wxRegionRefData(tempShape);
DisposeRgn( tempRgn );
}
else
{
m_refData = new wxRegionRefData;
} }
#else #else
wxFAIL_MSG( "not implemented" ); wxFAIL_MSG( "not implemented" );