diff options
author | das <das> | 2007-11-08 14:24:47 (GMT) |
---|---|---|
committer | das <das> | 2007-11-08 14:24:47 (GMT) |
commit | c08f2e1d5f2562b82353e92ed9c8e4243de8664c (patch) | |
tree | addebaf6715f8d5dccdc5296f9984f43d180217d /macosx/tkMacOSXSubwindows.c | |
parent | a8883697879f79d69b50fd4ccb658401d3c19b64 (diff) | |
download | tk-c08f2e1d5f2562b82353e92ed9c8e4243de8664c.zip tk-c08f2e1d5f2562b82353e92ed9c8e4243de8664c.tar.gz tk-c08f2e1d5f2562b82353e92ed9c8e4243de8664c.tar.bz2 |
* macosx/tkMacOSXSubwindows.c: add pixmap size field to MacDrawable
* macosx/tkMacOSXInt.h: struct; add flag for B&W pixmaps.
* macosx/tkMacOSXDraw.c:
* macosx/tkMacOSXEmbed.c:
* macosx/tkMacOSXMenu.c:
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 6810519..dc21a3d 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.24 2007/10/12 03:14:48 das Exp $ + * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.25 2007/11/08 14:24:47 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -1016,6 +1016,17 @@ TkMacOSXGetDrawablePort( resultPort = macWin->toplevel->grafPtr; } } else { + if ((macWin->flags & TK_IS_PIXMAP) && !macWin->grafPtr) { + Rect bounds = {0, 0, macWin->size.height, macWin->size.width}; + + ChkErr(NewGWorld, &macWin->grafPtr, + (macWin->flags & TK_IS_BW_PIXMAP) ? 1 : 0, + &bounds, NULL, NULL, 0 +#ifdef __LITTLE_ENDIAN__ + | kNativeEndianPixMap +#endif + ); + } resultPort = macWin->grafPtr; } } @@ -1301,24 +1312,19 @@ Tk_GetPixmap( macPix->drawRect = CGRectNull; macPix->referenceCount = 0; macPix->toplevel = NULL; - macPix->flags = TK_IS_PIXMAP; + macPix->flags = TK_IS_PIXMAP | (depth == 1 ? TK_IS_BW_PIXMAP : 0); macPix->grafPtr = NULL; macPix->context = NULL; + macPix->size = CGSizeMake(width, height); { - OSStatus err; - GWorldPtr gWorld; Rect bounds = {0, 0, height, width}; - err = ChkErr(NewGWorld, &gWorld, depth == 1 ? 1 : 0, &bounds, NULL, + ChkErr(NewGWorld, &macPix->grafPtr, depth == 1 ? 1 : 0, &bounds, NULL, NULL, 0 #ifdef __LITTLE_ENDIAN__ | kNativeEndianPixMap #endif ); - if (err != noErr) { - Tcl_Panic("Out of memory: NewGWorld failed in Tk_GetPixmap"); - } - macPix->grafPtr = gWorld; } return (Pixmap) macPix; @@ -1351,5 +1357,8 @@ Tk_FreePixmap( if (macPix->grafPtr) { DisposeGWorld(macPix->grafPtr); } + if (macPix->context) { + TkMacOSXDbgMsg("Cannot free CG backed Pixmap"); + } ckfree((char *) macPix); } |