summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authordas <das>2004-09-18 00:48:13 (GMT)
committerdas <das>2004-09-18 00:48:13 (GMT)
commit4e90c9ace0be718fce73b79c253345f5b168ce67 (patch)
tree2644046be4778867c8e5d56c566bbffbea03d87b /macosx/tkMacOSXDraw.c
parent706ae4361ffe2ba5511d30940ae9cd19a8fae435 (diff)
downloadtk-4e90c9ace0be718fce73b79c253345f5b168ce67.zip
tk-4e90c9ace0be718fce73b79c253345f5b168ce67.tar.gz
tk-4e90c9ace0be718fce73b79c253345f5b168ce67.tar.bz2
* macosx/README: typos
* macosx/tkMacOSXDraw.c (TkMacOSXSetUpCGContext): performance improvements: removed slow & unnecessary calls.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r--macosx/tkMacOSXDraw.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index e4d6431..81d36aa 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.4 2004/07/27 18:58:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.5 2004/09/18 00:48:14 das Exp $
*/
#include "tclInt.h"
@@ -1723,11 +1723,10 @@ TkMacOSXSetUpCGContext(
OSStatus err;
Rect boundsRect;
CGAffineTransform coordsTransform;
- RgnHandle clipRgn;
+ static RgnHandle clipRgn = NULL;
err = QDBeginCGContext(destPort, contextPtr);
outContext = *contextPtr;
- CGContextSaveGState(outContext);
/*
* Now clip the CG Context to the port. Note, we have already
@@ -1739,15 +1738,17 @@ TkMacOSXSetUpCGContext(
* visible region so we don't overwrite the window decoration.
*/
- clipRgn = NewRgn();
- GetPortClipRegion(destPort, clipRgn);
-
- SectRegionWithPortVisibleRegion(destPort, clipRgn);
+ if (!clipRgn) {
+ clipRgn = NewRgn();
+ }
GetPortBounds(destPort, &boundsRect);
+ RectRgn(clipRgn, &boundsRect);
+ SectRegionWithPortClipRegion(destPort, clipRgn);
+ SectRegionWithPortVisibleRegion(destPort, clipRgn);
ClipCGContextToRegion(outContext, &boundsRect, clipRgn);
- DisposeRgn(clipRgn);
+ SetEmptyRgn(clipRgn);
/*
* Note: You have to call SyncCGContextOriginWithPort
@@ -1823,7 +1824,6 @@ TkMacOSXReleaseCGContext(
CGrafPtr destPort,
CGContextRef *outContext)
{
- CGContextRestoreGState(*outContext);
CGContextSynchronize(*outContext);
QDEndCGContext(destPort, outContext);
}