1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * All Rights Reserved. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining 7*4882a593Smuzhiyun * a copy of this software and associated documentation files (the 8*4882a593Smuzhiyun * "Software"), to deal in the Software without restriction, including 9*4882a593Smuzhiyun * without limitation on the rights to use, copy, modify, merge, 10*4882a593Smuzhiyun * publish, distribute, sublicense, and/or sell copies of the Software, 11*4882a593Smuzhiyun * and to permit persons to whom the Software is furnished to do so, 12*4882a593Smuzhiyun * subject to the following conditions: 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * The above copyright notice and this permission notice (including the 15*4882a593Smuzhiyun * next paragraph) shall be included in all copies or substantial 16*4882a593Smuzhiyun * portions of the Software. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19*4882a593Smuzhiyun * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20*4882a593Smuzhiyun * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21*4882a593Smuzhiyun * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS 22*4882a593Smuzhiyun * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23*4882a593Smuzhiyun * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24*4882a593Smuzhiyun * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25*4882a593Smuzhiyun * SOFTWARE. 26*4882a593Smuzhiyun */ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /* 29*4882a593Smuzhiyun * Authors: 30*4882a593Smuzhiyun * Kevin E. Martin <kem@redhat.com> 31*4882a593Smuzhiyun * 32*4882a593Smuzhiyun */ 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun /** \file 35*4882a593Smuzhiyun * Interface for GC support. \see dmxgc.c */ 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun #ifndef DMXGC_H 38*4882a593Smuzhiyun #define DMXGC_H 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun #include "gcstruct.h" 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun /** GC private area. */ 43*4882a593Smuzhiyun typedef struct _dmxGCPriv { 44*4882a593Smuzhiyun const GCOps *ops; 45*4882a593Smuzhiyun const GCFuncs *funcs; 46*4882a593Smuzhiyun XlibGC gc; 47*4882a593Smuzhiyun Bool msc; 48*4882a593Smuzhiyun } dmxGCPrivRec, *dmxGCPrivPtr; 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun extern Bool dmxInitGC(ScreenPtr pScreen); 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun extern Bool dmxCreateGC(GCPtr pGC); 53*4882a593Smuzhiyun extern void dmxValidateGC(GCPtr pGC, unsigned long changes, 54*4882a593Smuzhiyun DrawablePtr pDrawable); 55*4882a593Smuzhiyun extern void dmxChangeGC(GCPtr pGC, unsigned long mask); 56*4882a593Smuzhiyun extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst); 57*4882a593Smuzhiyun extern void dmxDestroyGC(GCPtr pGC); 58*4882a593Smuzhiyun extern void dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); 59*4882a593Smuzhiyun extern void dmxDestroyClip(GCPtr pGC); 60*4882a593Smuzhiyun extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc); 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC); 63*4882a593Smuzhiyun extern Bool dmxBEFreeGC(GCPtr pGC); 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun /** Get private. */ 66*4882a593Smuzhiyun #define DMX_GET_GC_PRIV(_pGC) \ 67*4882a593Smuzhiyun (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey) 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun #define DMX_GC_FUNC_PROLOGUE(_pGC) \ 70*4882a593Smuzhiyun do { \ 71*4882a593Smuzhiyun dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \ 72*4882a593Smuzhiyun DMX_UNWRAP(funcs, _pGCPriv, (_pGC)); \ 73*4882a593Smuzhiyun if (_pGCPriv->ops) \ 74*4882a593Smuzhiyun DMX_UNWRAP(ops, _pGCPriv, (_pGC)); \ 75*4882a593Smuzhiyun } while (0) 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun #define DMX_GC_FUNC_EPILOGUE(_pGC) \ 78*4882a593Smuzhiyun do { \ 79*4882a593Smuzhiyun dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \ 80*4882a593Smuzhiyun DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC)); \ 81*4882a593Smuzhiyun if (_pGCPriv->ops) \ 82*4882a593Smuzhiyun DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC)); \ 83*4882a593Smuzhiyun } while (0) 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun #endif /* DMXGC_H */ 86