]> git.saurik.com Git - wxWidgets.git/commitdiff
making ref counting behavior consistent, activating QD variante for polygon region...
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 14 Dec 2007 17:26:17 +0000 (17:26 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 14 Dec 2007 17:26:17 +0000 (17:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/region.cpp

index 20d5d46b7d99204a31b6a0e3ac337208a8eb5d07..69e0e80e8254dd35c16e61f07e4e47ae0afdd5f2 100644 (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(points);
 
     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
 
     // 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 ) ;
 
         if ( x1 != x2 || y1 != y2 )
             ::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
     wxFAIL_MSG( "not implemented" );
     }
 #else
     wxFAIL_MSG( "not implemented" );