diff options
author | culler <culler> | 2020-07-29 03:11:02 (GMT) |
---|---|---|
committer | culler <culler> | 2020-07-29 03:11:02 (GMT) |
commit | a872071b3c86d4de2e5cb8e9a0d6e876064e561d (patch) | |
tree | 6b1850053b8abe73665026e88af9fdda5a12db69 /macosx/tkMacOSXDraw.c | |
parent | 916ea258d01119b9f5e02836ac8a92c4d6c4f520 (diff) | |
download | tk-a872071b3c86d4de2e5cb8e9a0d6e876064e561d.zip tk-a872071b3c86d4de2e5cb8e9a0d6e876064e561d.tar.gz tk-a872071b3c86d4de2e5cb8e9a0d6e876064e561d.tar.bz2 |
Clean up tkMacOSXColor.c so it is not so painful to add new colors.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index fd8a1eb..645b72b 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -43,6 +43,7 @@ static int cgAntiAliasLimit = 0; static int useThemedToplevel = 0; static int useThemedFrame = 0; +static unsigned long transparentColor; /* * Prototypes for functions used only in this file. @@ -99,6 +100,7 @@ TkMacOSXInitCGDrawing( (char *) &useThemedFrame, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); } + transparentColor = TkMacOSXClearPixel(); } return TCL_OK; } @@ -545,7 +547,7 @@ TkMacOSXGetNSImageWithBitmap( unsigned long origBackground = gc->background; - gc->background = TRANSPARENT_PIXEL << 24; + gc->background = transparentColor; XSetClipOrigin(display, gc, 0, 0); XCopyPlane(display, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1); gc->background = origBackground; @@ -664,17 +666,18 @@ TkMacOSXDrawCGImage( dstBounds = CGRectOffset(dstBounds, macDraw->xOff, macDraw->yOff); if (CGImageIsMask(image)) { if (macDraw->flags & TK_IS_BW_PIXMAP) { + /* * Set fill color to black; background comes from the context, * or is transparent. */ - if (imageBackground != TRANSPARENT_PIXEL << 24) { + if (imageBackground != transparentColor) { CGContextClearRect(context, dstBounds); } CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0); } else { - if (imageBackground != TRANSPARENT_PIXEL << 24) { + if (imageBackground != transparentColor) { TkMacOSXSetColorInContext(gc, imageBackground, context); CGContextFillRect(context, dstBounds); } |