dmxgc.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
00003  *
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining
00007  * a copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation on the rights to use, copy, modify, merge,
00010  * publish, distribute, sublicense, and/or sell copies of the Software,
00011  * and to permit persons to whom the Software is furnished to do so,
00012  * subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial
00016  * portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00019  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00021  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
00022  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00023  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00024  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00025  * SOFTWARE.
00026  */
00027 
00028 /*
00029  * Authors:
00030  *   Kevin E. Martin <kem@redhat.com>
00031  *
00032  */
00033 
00037 #ifndef DMXGC_H
00038 #define DMXGC_H
00039 
00040 #include "gcstruct.h"
00041 
00043 typedef struct _dmxGCPriv {
00044     GCOps   *ops;
00045     GCFuncs *funcs;
00046     XlibGC   gc;
00047     Bool     msc;
00048 } dmxGCPrivRec, *dmxGCPrivPtr;
00049 
00050 
00051 extern Bool dmxInitGC(ScreenPtr pScreen);
00052 
00053 extern Bool dmxCreateGC(GCPtr pGC);
00054 extern void dmxValidateGC(GCPtr pGC, unsigned long changes,
00055                           DrawablePtr pDrawable);
00056 extern void dmxChangeGC(GCPtr pGC, unsigned long mask);
00057 extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst);
00058 extern void dmxDestroyGC(GCPtr pGC);
00059 extern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
00060 extern void dmxDestroyClip(GCPtr pGC);
00061 extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
00062 
00063 extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
00064 extern Bool dmxBEFreeGC(GCPtr pGC);
00065 
00067 #define DMX_GET_GC_PRIV(_pGC)                                           \
00068     (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey)
00069 
00070 #define DMX_GC_FUNC_PROLOGUE(_pGC)                                      \
00071 do {                                                                    \
00072     dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC);                      \
00073     DMX_UNWRAP(funcs, _pGCPriv, (_pGC));                                \
00074     if (_pGCPriv->ops)                                                  \
00075         DMX_UNWRAP(ops, _pGCPriv, (_pGC));                              \
00076 } while (0)
00077 
00078 #define DMX_GC_FUNC_EPILOGUE(_pGC)                                      \
00079 do {                                                                    \
00080     dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC);                      \
00081     DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC));                     \
00082     if (_pGCPriv->ops)                                                  \
00083         DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC));                     \
00084 } while (0)
00085 
00086 #endif /* DMXGC_H */