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)
commitd13722ccef1255b9bf4059b3c47cf34d73a290db (patch)
tree2644046be4778867c8e5d56c566bbffbea03d87b /macosx/tkMacOSXDraw.c
parentbecc17976a3c5b0702e241e563c9c94b9a733ade (diff)
downloadtk-d13722ccef1255b9bf4059b3c47cf34d73a290db.zip
tk-d13722ccef1255b9bf4059b3c47cf34d73a290db.tar.gz
tk-d13722ccef1255b9bf4059b3c47cf34d73a290db.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);
}