diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index d8001f1..c1fe8c5 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -12,7 +12,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.32 2007/12/13 15:27:09 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.33 2008/02/27 00:12:33 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -43,7 +43,7 @@ int tkMacOSXUseCGDrawing = 1; int tkPictureIsOpen; -static PixPatHandle penPat = NULL; +static PixPatHandle penPat = NULL, tmpPixPat = NULL; static int cgAntiAliasLimit = 0; #define notAA(w) ((w) < cgAntiAliasLimit) @@ -1502,20 +1502,27 @@ TkMacOSXSetUpGraphicsPort( GC gc, /* GC to apply to current port. */ GWorldPtr destPort) { + CGrafPtr savePort; + Boolean portChanged; + + portChanged = QDSwapPort(destPort, &savePort); PenNormal(); if (gc) { - if (penPat == NULL) { - penPat = NewPixPat(); + if (!penPat) { + if (!tmpPixPat) { + penPat = NewPixPat(); + } else { + penPat = tmpPixPat; + tmpPixPat = NULL; + } } TkMacOSXSetColorInPort(gc->foreground, 1, penPat, destPort); - SetPortPenPixPat(destPort, penPat); + PenPixPat(penPat); if(gc->function == GXxor) { - SetPortPenMode(destPort, patXor); + PenMode(patXor); } if (gc->line_width > 1) { - Point s = {gc->line_width, gc->line_width}; - - SetPortPenSize(destPort, s); + PenSize(gc->line_width, gc->line_width); } if (gc->line_style != LineSolid) { /* @@ -1524,6 +1531,9 @@ TkMacOSXSetUpGraphicsPort( */ } } + if (portChanged) { + QDSwapPort(savePort, NULL); + } } /* @@ -1576,7 +1586,7 @@ TkMacOSXSetupDrawingContext( goto end; } if (useCG) { - dc.context = macDraw->context;; + dc.context = macDraw->context; } if (!dc.context || !(macDraw->flags & TK_IS_PIXMAP)) { dc.port = TkMacOSXGetDrawablePort(d); @@ -1743,7 +1753,11 @@ TkMacOSXRestoreDrawingContext( DisposeRgn(dcPtr->saveClip); } if (dcPtr->penPat) { - DisposePixPat(dcPtr->penPat); + if (!tmpPixPat) { + tmpPixPat = dcPtr->penPat; + } else { + DisposePixPat(dcPtr->penPat); + } } if (dcPtr->saveState) { ChkErr(SetThemeDrawingState, dcPtr->saveState, true); @@ -1756,7 +1770,7 @@ TkMacOSXRestoreDrawingContext( QDSwapPort(dcPtr->savePort, NULL); } #ifdef TK_MAC_DEBUG - bzero(dcPtr, sizeof(dcPtr)); + bzero(dcPtr, sizeof(TkMacOSXDrawingContext)); #endif /* TK_MAC_DEBUG */ } |