1706f2543Smrg/*
2706f2543Smrg * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
3706f2543Smrg *
4706f2543Smrg * All Rights Reserved.
5706f2543Smrg *
6706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining
7706f2543Smrg * a copy of this software and associated documentation files (the
8706f2543Smrg * "Software"), to deal in the Software without restriction, including
9706f2543Smrg * without limitation on the rights to use, copy, modify, merge,
10706f2543Smrg * publish, distribute, sublicense, and/or sell copies of the Software,
11706f2543Smrg * and to permit persons to whom the Software is furnished to do so,
12706f2543Smrg * subject to the following conditions:
13706f2543Smrg *
14706f2543Smrg * The above copyright notice and this permission notice (including the
15706f2543Smrg * next paragraph) shall be included in all copies or substantial
16706f2543Smrg * portions of the Software.
17706f2543Smrg *
18706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19706f2543Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20706f2543Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21706f2543Smrg * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22706f2543Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23706f2543Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24706f2543Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25706f2543Smrg * SOFTWARE.
26706f2543Smrg */
27706f2543Smrg
28706f2543Smrg/*
29706f2543Smrg * Authors:
30706f2543Smrg *   Kevin E. Martin <kem@redhat.com>
31706f2543Smrg *
32706f2543Smrg */
33706f2543Smrg
34706f2543Smrg/** \file
35706f2543Smrg * Interface for GC support.  \see dmxgc.c */
36706f2543Smrg
37706f2543Smrg#ifndef DMXGC_H
38706f2543Smrg#define DMXGC_H
39706f2543Smrg
40706f2543Smrg#include "gcstruct.h"
41706f2543Smrg
42706f2543Smrg/** GC private area. */
43706f2543Smrgtypedef struct _dmxGCPriv {
44706f2543Smrg    GCOps   *ops;
45706f2543Smrg    GCFuncs *funcs;
46706f2543Smrg    XlibGC   gc;
47706f2543Smrg    Bool     msc;
48706f2543Smrg} dmxGCPrivRec, *dmxGCPrivPtr;
49706f2543Smrg
50706f2543Smrg
51706f2543Smrgextern Bool dmxInitGC(ScreenPtr pScreen);
52706f2543Smrg
53706f2543Smrgextern Bool dmxCreateGC(GCPtr pGC);
54706f2543Smrgextern void dmxValidateGC(GCPtr pGC, unsigned long changes,
55706f2543Smrg			  DrawablePtr pDrawable);
56706f2543Smrgextern void dmxChangeGC(GCPtr pGC, unsigned long mask);
57706f2543Smrgextern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst);
58706f2543Smrgextern void dmxDestroyGC(GCPtr pGC);
59706f2543Smrgextern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
60706f2543Smrgextern void dmxDestroyClip(GCPtr pGC);
61706f2543Smrgextern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
62706f2543Smrg
63706f2543Smrgextern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
64706f2543Smrgextern Bool dmxBEFreeGC(GCPtr pGC);
65706f2543Smrg
66706f2543Smrg/** Get private. */
67706f2543Smrg#define DMX_GET_GC_PRIV(_pGC)						\
68706f2543Smrg    (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey)
69706f2543Smrg
70706f2543Smrg#define DMX_GC_FUNC_PROLOGUE(_pGC)					\
71706f2543Smrgdo {									\
72706f2543Smrg    dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC);			\
73706f2543Smrg    DMX_UNWRAP(funcs, _pGCPriv, (_pGC));				\
74706f2543Smrg    if (_pGCPriv->ops)							\
75706f2543Smrg	DMX_UNWRAP(ops, _pGCPriv, (_pGC));				\
76706f2543Smrg} while (0)
77706f2543Smrg
78706f2543Smrg#define DMX_GC_FUNC_EPILOGUE(_pGC)					\
79706f2543Smrgdo {									\
80706f2543Smrg    dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC);			\
81706f2543Smrg    DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC));			\
82706f2543Smrg    if (_pGCPriv->ops)							\
83706f2543Smrg	DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC));			\
84706f2543Smrg} while (0)
85706f2543Smrg
86706f2543Smrg#endif /* DMXGC_H */
87