summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authordas <das>2006-05-12 18:17:48 (GMT)
committerdas <das>2006-05-12 18:17:48 (GMT)
commit114d3cd57863e0f50a373996e6c9004963a35f4a (patch)
treecd23015b14a776e288d49f24dec1f6c29be75a35 /macosx/tkMacOSXDraw.c
parent1eaf61f1bb88dff80fda08fde5ac5adcecbe5af6 (diff)
downloadtk-114d3cd57863e0f50a373996e6c9004963a35f4a.zip
tk-114d3cd57863e0f50a373996e6c9004963a35f4a.tar.gz
tk-114d3cd57863e0f50a373996e6c9004963a35f4a.tar.bz2
* generic/tkCanvWind.c (DisplayWinItem, WinItemRequestProc): ensure
canvas window items are unmapped when canvas is unmapped. [Bug 940117] * macosx/tkMacOSXSubwindows.c (TkMacOSXUpdateClipRgn): empty clip region of unmapped windows to prevent any drawing into them or into their children from becoming visible. [Bug 940117] * macosx/tkMacOSXInt.h: revert Jim's attempt of 2005-03-14 to * macosx/tkMacOSXSubwindows.c: fix Bug 940117 as it disables Map/Unmap event propagation to children. [Bug 1480105] * macosx/tkMacOSXDraw.c (TkPutImage): handle tkPictureIsOpen flag, fixes incorrect positioning of images with complex alpha on native buttons; actual alpha blending is still broken in this situation. [Bug 1155596] * macosx/tkMacOSXEvent.c (TkMacOSXProcessCommandEvent): * macosx/tkMacOSXMenus.c (TkMacOSXInitMenus): workaround carbon bug with key shortcut for 'Preferences' app menu item. [Bug 1481503] * macosx/tkMacOSXKeyEvent.c (TkMacOSXProcessKeyboardEvent): only check for HICommand menu item shortcuts in the application menu. * macosx/tkMacOSXInt.h: initialize keyboard layout setup in * macosx/tkMacOSXInit.c: TkpInit() rather than during handling of * macosx/tkMacOSXKeyEvent.c: first key down event. * macosx/tkMacOSXDraw.c: add optional debug code to flash clip * macosx/tkMacOSXSubwindows.c: regions during update or draw.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r--macosx/tkMacOSXDraw.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index edf3817..5d254f1 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -7,16 +7,23 @@
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
+ * Copyright (c) 2006 Daniel A. Steffen <das@users.sourceforge.net>
*
* 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.14 2006/04/11 10:20:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.15 2006/05/12 18:17:48 das Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMacOSXDebug.h"
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_DRAWING
+#endif
+*/
+
#ifndef PI
# define PI 3.14159265358979323846
#endif
@@ -272,16 +279,12 @@ XCopyPlane(
srcPort = TkMacOSXGetDrawablePort(src);
dstPort = TkMacOSXGetDrawablePort(dst);
- if (tmpRgn == NULL) {
- tmpRgn = NewRgn();
- }
display->request++;
GetGWorld(&saveWorld, &saveDevice);
SetGWorld(dstPort, NULL);
TkMacOSXSetUpClippingRgn(dst);
-
srcBit = GetPortBitMapForCopyBits(srcPort);
dstBit = GetPortBitMapForCopyBits(dstPort);
SetRect(&srcRect, (short) (srcDraw->xOff + src_x),
@@ -395,12 +398,9 @@ TkPutImage(
int i, j;
BitMap bitmap;
char *newData = NULL;
- Rect destRect, srcRect;
+ Rect destRect, srcRect, *destPtr, *srcPtr;
destPort = TkMacOSXGetDrawablePort(d);
- SetRect(&destRect, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
- dstDraw->xOff + dest_x + width, dstDraw->yOff + dest_y + height);
- SetRect(&srcRect, src_x, src_y, src_x + width, src_y + height);
display->request++;
GetGWorld(&saveWorld, &saveDevice);
@@ -408,12 +408,32 @@ TkPutImage(
TkMacOSXSetUpClippingRgn(d);
+ srcPtr = &srcRect;
+ SetRect(srcPtr, src_x, src_y, src_x + width, src_y + height);
+ if (tkPictureIsOpen) {
+ /*
+ * When rendering into a picture, after a call to "OpenCPicture"
+ * the clipping is seriously WRONG and also INCONSISTENT with the
+ * clipping for single plane bitmaps.
+ * To circumvent this problem, we clip to the whole window
+ */
+
+ Rect clpRect;
+ GetPortBounds(destPort,&clpRect);
+ ClipRect(&clpRect);
+ destPtr = srcPtr;
+ } else {
+ destPtr = &destRect;
+ SetRect(destPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width, dstDraw->yOff + dest_y + height);
+ }
+
if (image->obdata) {
/* Image from XGetImage, copy from containing GWorld directly */
GWorldPtr srcPort = TkMacOSXGetDrawablePort((Drawable)image->obdata);
CopyBits(GetPortBitMapForCopyBits(srcPort),
GetPortBitMapForCopyBits(destPort),
- &srcRect, &destRect, srcCopy, NULL);
+ srcPtr, destPtr, srcCopy, NULL);
} else if (image->depth == 1) {
/*
* This code assumes a pixel depth of 1
@@ -448,7 +468,7 @@ TkPutImage(
bitmap.rowBytes = image->bytes_per_line;
}
destBits = GetPortBitMapForCopyBits(destPort);
- CopyBits(&bitmap, destBits, &srcRect, &destRect, srcCopy, NULL);
+ CopyBits(&bitmap, destBits, srcPtr, destPtr, srcCopy, NULL);
} else {
/*
* Color image
@@ -479,7 +499,7 @@ TkPutImage(
pixmap.rowBytes = image->bytes_per_line | 0x8000;
CopyBits((BitMap *) &pixmap, GetPortBitMapForCopyBits(destPort),
- &srcRect, &destRect, srcCopy, NULL);
+ srcPtr, destPtr, srcCopy, NULL);
}
if (newData != NULL) {
@@ -1895,6 +1915,16 @@ TkMacOSXSetUpClippingRgn(
TkMacOSXUpdateClipRgn(macDraw->winPtr);
}
+#if defined(TK_MAC_DEBUG) && defined(TK_MAC_DEBUG_DRAWING)
+ TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
+ CGrafPtr port, RgnHandle region);
+ if (QDDebugFlashRegion) {
+ CGrafPtr grafPtr = TkMacOSXGetDrawablePort(drawable);
+ /* Carbon-internal region flashing SPI (c.f. Technote 2124) */
+ QDDebugFlashRegion(grafPtr, macDraw->clipRgn);
+ }
+#endif /* TK_MAC_DEBUG_DRAWING */
+
/*
* When a menu is up, the Mac does not expect drawing to occur and
* does not clip out the menu. We have to do it ourselves. This