summaryrefslogtreecommitdiff
path: root/exa/exa_priv.h
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2009-01-31 18:53:52 +0100
committerMaarten Maathuis <madman2003@gmail.com>2009-02-06 18:42:38 +0100
commit015c99a4ad572f5a1b68054efb070e1ffee1fed0 (patch)
tree0a44591380387f5a856917884a5b5277022188be /exa/exa_priv.h
parent5e6a06fe691db63ccf2dc7161a1f6c71c09741b7 (diff)
exa: properly wrap GC functions
Diffstat (limited to 'exa/exa_priv.h')
-rw-r--r--exa/exa_priv.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 3b589488e..a41e5fe00 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -180,6 +180,33 @@ extern DevPrivateKey exaGCPrivateKey;
#define ExaGetGCPriv(gc) ((ExaGCPrivPtr)dixLookupPrivate(&(gc)->devPrivates, exaGCPrivateKey))
#define ExaGCPriv(gc) ExaGCPrivPtr pExaGC = ExaGetGCPriv(gc)
+/*
+ * Some macros to deal with function wrapping.
+ */
+#define wrap(priv, real, mem, func) {\
+ priv->Saved##mem = real->mem; \
+ real->mem = func; \
+}
+
+#define unwrap(priv, real, mem) {\
+ real->mem = priv->Saved##mem; \
+}
+
+#define swap(priv, real, mem) {\
+ void *tmp = priv->Saved##mem; \
+ priv->Saved##mem = real->mem; \
+ real->mem = tmp; \
+}
+
+#define EXA_GC_PROLOGUE(_gc_) \
+ ExaGCPriv(_gc_); \
+ swap(pExaGC, _gc_, funcs); \
+ swap(pExaGC, _gc_, ops);
+
+#define EXA_GC_EPILOGUE(_gc_) \
+ swap(pExaGC, _gc_, funcs); \
+ swap(pExaGC, _gc_, ops);
+
/** Align an offset to an arbitrary alignment */
#define EXA_ALIGN(offset, align) (((offset) + (align) - 1) - \
(((offset) + (align) - 1) % (align)))
@@ -243,8 +270,8 @@ typedef struct {
typedef struct {
/* GC values from the layer below. */
- GCOps *ops;
- GCFuncs *funcs;
+ GCOps *Savedops;
+ GCFuncs *Savedfuncs;
} ExaGCPrivRec, *ExaGCPrivPtr;
typedef struct _ExaMigrationRec {
@@ -447,6 +474,8 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
Pixel bitplane,
void *closure);
+extern const GCFuncs exaGCFuncs;
+
/* exa_render.c */
Bool
exaOpReadsDestination (CARD8 op);