summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authordas <das>2007-11-08 14:24:47 (GMT)
committerdas <das>2007-11-08 14:24:47 (GMT)
commitc08f2e1d5f2562b82353e92ed9c8e4243de8664c (patch)
treeaddebaf6715f8d5dccdc5296f9984f43d180217d /macosx/tkMacOSXDraw.c
parenta8883697879f79d69b50fd4ccb658401d3c19b64 (diff)
downloadtk-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/tkMacOSXDraw.c')
-rw-r--r--macosx/tkMacOSXDraw.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 06b09fb..e5b39d1 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.30 2007/10/12 03:14:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.31 2007/11/08 14:24:47 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -41,6 +41,8 @@ RgnHandle tkMacOSXtmpQdRgn = NULL;
int tkMacOSXUseCGDrawing = 1;
+int tkPictureIsOpen;
+
static PixPatHandle penPat = NULL;
static int cgAntiAliasLimit = 0;
@@ -151,7 +153,7 @@ XCopyArea(
GC gc, /* GC to use. */
int src_x, /* X & Y, width & height */
int src_y, /* define the source rectangle */
- unsigned int width, /* the will be copied. */
+ unsigned int width, /* that will be copied. */
unsigned int height,
int dest_x, /* Dest X & Y on dest rect. */
int dest_y)
@@ -234,7 +236,7 @@ XCopyPlane(
GC gc, /* GC to use. */
int src_x, /* X & Y, width & height */
int src_y, /* define the source rectangle */
- unsigned int width, /* the will be copied. */
+ unsigned int width, /* that will be copied. */
unsigned int height,
int dest_x, /* Dest X & Y on dest rect. */
int dest_y,
@@ -1573,21 +1575,29 @@ TkMacOSXSetupDrawingContext(
}
goto end;
}
- dc.port = TkMacOSXGetDrawablePort(d);
- if (dc.port) {
- GetPortBounds(dc.port, &dc.portBounds);
+ if (useCG) {
+ dc.context = macDraw->context;;
+ }
+ if (!dc.context || !(macDraw->flags & TK_IS_PIXMAP)) {
+ dc.port = TkMacOSXGetDrawablePort(d);
+ if (dc.port) {
+ GetPortBounds(dc.port, &dc.portBounds);
+ }
}
- dc.context = macDraw->context;
- if (dc.context && useCG) {
+ if (dc.context) {
if (!dc.port) {
- TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
- CGRect r = CGContextGetClipBoundingBox(dc.context);
+ CGRect r;
- SetRect(&dc.portBounds, r.origin.x + macDraw->xOff,
- r.origin.y + macDraw->yOff,
- r.origin.x + r.size.width + macDraw->xOff,
- r.origin.y + r.size.height + macDraw->yOff);
+ TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
+ r = CGContextGetClipBoundingBox(dc.context);
+ ) TK_ELSE_MAC_OS_X (3,
+ r.origin = CGPointZero;
+ r.size = macDraw->size;
) TK_ENDIF
+ SetRect(&dc.portBounds, r.origin.x + macDraw->xOff,
+ r.origin.y + macDraw->yOff,
+ r.origin.x + r.size.width + macDraw->xOff,
+ r.origin.y + r.size.height + macDraw->yOff);
}
CGContextSaveGState(dc.context);
dc.saveState = (void*)1;