summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
authorkevin_walzer <kevin_walzer@noemail.net>2012-09-12 03:05:29 (GMT)
committerkevin_walzer <kevin_walzer@noemail.net>2012-09-12 03:05:29 (GMT)
commit69d00d962e56f91ce858ce18e2bee164628bbc75 (patch)
tree531b9edd57ee78802a71cb6c0fd09a0367f59211 /xlib
parentcbd752bac99c77684412fae9adbbd1412636f549 (diff)
downloadtk-69d00d962e56f91ce858ce18e2bee164628bbc75.zip
tk-69d00d962e56f91ce858ce18e2bee164628bbc75.tar.gz
tk-69d00d962e56f91ce858ce18e2bee164628bbc75.tar.bz2
Review branch for merge of Tk-Cocoa into Tk 8.5 main branch
FossilOrigin-Name: 7f1b01b50fafe610db9766488e304e187aaadffe
Diffstat (limited to 'xlib')
-rw-r--r--xlib/xgc.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 6c5e31c..11ddd2b 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -5,23 +5,30 @@
* contexts.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
- * Copyright (c) 2002-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2002-2009 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright 2008-2009, Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * RCS: @(#) $Id$
*/
#include <tkInt.h>
#if !defined(MAC_OSX_TK)
# include <X11/Xlib.h>
-#endif
-#ifdef MAC_OSX_TK
+# define gcCacheSize 0
+# define TkpInitGCCache(gc)
+# define TkpFreeGCCache(gc)
+# define TkpGetGCCache(gc)
+#else
# include <tkMacOSXInt.h>
# include <X11/Xlib.h>
# include <X11/X.h>
# define Cursor XCursor
# define Region XRegion
+# define gcCacheSize sizeof(TkpGCCache)
#endif
#undef TkSetRegion
@@ -118,7 +125,8 @@ XCreateGC(
#define MAX_DASH_LIST_SIZE 10
- gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE);
+ gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE +
+ gcCacheSize);
if (!gp) {
return None;
}
@@ -159,10 +167,33 @@ XCreateGC(
clip_mask->type = TKP_CLIP_PIXMAP;
clip_mask->value.pixmap = values->clip_mask;
}
+ TkpInitGCCache(gp);
return gp;
}
+#ifdef MAC_OSX_TK
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkpGetGCCache --
+ *
+ * Results:
+ * Pointer to the TkpGCCache at the end of the GC.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+TkpGCCache*
+TkpGetGCCache(GC gc) {
+ return (gc ? (TkpGCCache*)(((char*) gc) + sizeof(XGCValues) +
+ MAX_DASH_LIST_SIZE) : NULL);
+}
+#endif
+
/*
*----------------------------------------------------------------------
*
@@ -242,6 +273,7 @@ int XFreeGC(
{
if (gc != None) {
FreeClipMask(gc);
+ TkpFreeGCCache(gc);
ckfree((char *) gc);
}
return Success;