45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining
45e9809aff7304721fddb95654901b32195c9c7avboxsync * a copy of this software and associated documentation files (the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * "Software"), to deal in the Software without restriction, including
45e9809aff7304721fddb95654901b32195c9c7avboxsync * without limitation on the rights to use, copy, modify, merge,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * publish, distribute, sublicense, and/or sell copies of the Software,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and to permit persons to whom the Software is furnished to do so,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * subject to the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice and this permission notice (including the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * next paragraph) shall be included in all copies or substantial
45e9809aff7304721fddb95654901b32195c9c7avboxsync * portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45e9809aff7304721fddb95654901b32195c9c7avboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45e9809aff7304721fddb95654901b32195c9c7avboxsync * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
45e9809aff7304721fddb95654901b32195c9c7avboxsync * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Authors:
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Kevin E. Martin <kem@redhat.com>
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/** \file
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Interface for GC support. \see dmxgc.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef DMXGC_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMXGC_H
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include "gcstruct.h"
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/** GC private area. */
45e9809aff7304721fddb95654901b32195c9c7avboxsynctypedef struct _dmxGCPriv {
45e9809aff7304721fddb95654901b32195c9c7avboxsync GCOps *ops;
45e9809aff7304721fddb95654901b32195c9c7avboxsync GCFuncs *funcs;
45e9809aff7304721fddb95654901b32195c9c7avboxsync XlibGC gc;
45e9809aff7304721fddb95654901b32195c9c7avboxsync Bool msc;
45e9809aff7304721fddb95654901b32195c9c7avboxsync} dmxGCPrivRec, *dmxGCPrivPtr;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern Bool dmxInitGC(ScreenPtr pScreen);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern Bool dmxCreateGC(GCPtr pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxValidateGC(GCPtr pGC, unsigned long changes,
45e9809aff7304721fddb95654901b32195c9c7avboxsync DrawablePtr pDrawable);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxChangeGC(GCPtr pGC, unsigned long mask);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxDestroyGC(GCPtr pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxDestroyClip(GCPtr pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern Bool dmxBEFreeGC(GCPtr pGC);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/** Private index. \see dmxgc.c \see dmxscrinit.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int dmxGCPrivateIndex;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/** Get private. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_GET_GC_PRIV(_pGC) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (dmxGCPrivPtr)(_pGC)->devPrivates[dmxGCPrivateIndex].ptr
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_GC_FUNC_PROLOGUE(_pGC) \
45e9809aff7304721fddb95654901b32195c9c7avboxsyncdo { \
45e9809aff7304721fddb95654901b32195c9c7avboxsync dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMX_UNWRAP(funcs, _pGCPriv, (_pGC)); \
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (_pGCPriv->ops) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMX_UNWRAP(ops, _pGCPriv, (_pGC)); \
45e9809aff7304721fddb95654901b32195c9c7avboxsync} while (0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_GC_FUNC_EPILOGUE(_pGC) \
45e9809aff7304721fddb95654901b32195c9c7avboxsyncdo { \
45e9809aff7304721fddb95654901b32195c9c7avboxsync dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC)); \
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (_pGCPriv->ops) \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC)); \
45e9809aff7304721fddb95654901b32195c9c7avboxsync} while (0)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif /* DMXGC_H */