From c033876ec0d30cbeca8fa5c7667803f1f2b71d62 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 17 Oct 2002 20:32:29 +0000 Subject: [PATCH] pict generation code takes into account mask, getting rid of a memory leak git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/bitmap.cpp | 13 ++++++++++--- src/mac/carbon/bitmap.cpp | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/mac/bitmap.cpp b/src/mac/bitmap.cpp index 0cf96a6f1e..0a905dcaf5 100644 --- a/src/mac/bitmap.cpp +++ b/src/mac/bitmap.cpp @@ -272,14 +272,19 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask) SetGWorld( wp , NULL ) ; Rect portRect ; - GetPortBounds( wp , &portRect ) ; - + if ( clipRgn ) + portRect = (**clipRgn).rgnBBox ; + else + GetPortBounds( wp , &portRect ) ; pict = OpenPicture(&portRect); if(pict) { RGBForeColor( &black ) ; RGBBackColor( &white ) ; - + + if ( clipRgn ) + SetClip( clipRgn ) ; + LockPixels( GetGWorldPixMap( wp ) ) ; CopyBits(GetPortBitMapForCopyBits(wp), GetPortBitMapForCopyBits(wp), @@ -290,6 +295,8 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask) ClosePicture(); } SetGWorld( origPort , origDev ) ; + if ( clipRgn ) + DisposeRgn( clipRgn ) ; return pict; } diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 0cf96a6f1e..0a905dcaf5 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -272,14 +272,19 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask) SetGWorld( wp , NULL ) ; Rect portRect ; - GetPortBounds( wp , &portRect ) ; - + if ( clipRgn ) + portRect = (**clipRgn).rgnBBox ; + else + GetPortBounds( wp , &portRect ) ; pict = OpenPicture(&portRect); if(pict) { RGBForeColor( &black ) ; RGBBackColor( &white ) ; - + + if ( clipRgn ) + SetClip( clipRgn ) ; + LockPixels( GetGWorldPixMap( wp ) ) ; CopyBits(GetPortBitMapForCopyBits(wp), GetPortBitMapForCopyBits(wp), @@ -290,6 +295,8 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask) ClosePicture(); } SetGWorld( origPort , origDev ) ; + if ( clipRgn ) + DisposeRgn( clipRgn ) ; return pict; }