xref: /OK3568_Linux_fs/external/xserver/include/gcstruct.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /***********************************************************
2*4882a593Smuzhiyun 
3*4882a593Smuzhiyun Copyright 1987, 1998  The Open Group
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun Permission to use, copy, modify, distribute, and sell this software and its
6*4882a593Smuzhiyun documentation for any purpose is hereby granted without fee, provided that
7*4882a593Smuzhiyun the above copyright notice appear in all copies and that both that
8*4882a593Smuzhiyun copyright notice and this permission notice appear in supporting
9*4882a593Smuzhiyun documentation.
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun The above copyright notice and this permission notice shall be included in
12*4882a593Smuzhiyun all copies or substantial portions of the Software.
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*4882a593Smuzhiyun IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*4882a593Smuzhiyun FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17*4882a593Smuzhiyun OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18*4882a593Smuzhiyun AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19*4882a593Smuzhiyun CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun Except as contained in this notice, the name of The Open Group shall not be
22*4882a593Smuzhiyun used in advertising or otherwise to promote the sale, use or other dealings
23*4882a593Smuzhiyun in this Software without prior written authorization from The Open Group.
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun                         All Rights Reserved
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun Permission to use, copy, modify, and distribute this software and its
30*4882a593Smuzhiyun documentation for any purpose and without fee is hereby granted,
31*4882a593Smuzhiyun provided that the above copyright notice appear in all copies and that
32*4882a593Smuzhiyun both that copyright notice and this permission notice appear in
33*4882a593Smuzhiyun supporting documentation, and that the name of Digital not be
34*4882a593Smuzhiyun used in advertising or publicity pertaining to distribution of the
35*4882a593Smuzhiyun software without specific, written prior permission.
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
38*4882a593Smuzhiyun ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
39*4882a593Smuzhiyun DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
40*4882a593Smuzhiyun ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
41*4882a593Smuzhiyun WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
42*4882a593Smuzhiyun ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
43*4882a593Smuzhiyun SOFTWARE.
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun ******************************************************************/
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #ifndef GCSTRUCT_H
48*4882a593Smuzhiyun #define GCSTRUCT_H
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #include "gc.h"
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun #include "regionstr.h"
53*4882a593Smuzhiyun #include "region.h"
54*4882a593Smuzhiyun #include "pixmap.h"
55*4882a593Smuzhiyun #include "screenint.h"
56*4882a593Smuzhiyun #include "privates.h"
57*4882a593Smuzhiyun #include <X11/Xprotostr.h>
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun #define GCAllBits ((1 << (GCLastBit + 1)) - 1)
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun /*
62*4882a593Smuzhiyun  * functions which modify the state of the GC
63*4882a593Smuzhiyun  */
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun typedef struct _GCFuncs {
66*4882a593Smuzhiyun     void (*ValidateGC) (GCPtr /*pGC */ ,
67*4882a593Smuzhiyun                         unsigned long /*stateChanges */ ,
68*4882a593Smuzhiyun                         DrawablePtr /*pDrawable */ );
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun     void (*ChangeGC) (GCPtr /*pGC */ ,
71*4882a593Smuzhiyun                       unsigned long /*mask */ );
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun     void (*CopyGC) (GCPtr /*pGCSrc */ ,
74*4882a593Smuzhiyun                     unsigned long /*mask */ ,
75*4882a593Smuzhiyun                     GCPtr /*pGCDst */ );
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun     void (*DestroyGC) (GCPtr /*pGC */ );
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun     void (*ChangeClip) (GCPtr pGC,
80*4882a593Smuzhiyun                         int type,
81*4882a593Smuzhiyun                         void *pvalue,
82*4882a593Smuzhiyun                         int nrects);
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun     void (*DestroyClip) (GCPtr /*pGC */ );
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun     void (*CopyClip) (GCPtr /*pgcDst */ ,
87*4882a593Smuzhiyun                       GCPtr /*pgcSrc */ );
88*4882a593Smuzhiyun } GCFuncs;
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun /*
91*4882a593Smuzhiyun  * graphics operations invoked through a GC
92*4882a593Smuzhiyun  */
93*4882a593Smuzhiyun 
94*4882a593Smuzhiyun typedef struct _GCOps {
95*4882a593Smuzhiyun     void (*FillSpans) (DrawablePtr /*pDrawable */ ,
96*4882a593Smuzhiyun                        GCPtr /*pGC */ ,
97*4882a593Smuzhiyun                        int /*nInit */ ,
98*4882a593Smuzhiyun                        DDXPointPtr /*pptInit */ ,
99*4882a593Smuzhiyun                        int * /*pwidthInit */ ,
100*4882a593Smuzhiyun                        int /*fSorted */ );
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun     void (*SetSpans) (DrawablePtr /*pDrawable */ ,
103*4882a593Smuzhiyun                       GCPtr /*pGC */ ,
104*4882a593Smuzhiyun                       char * /*psrc */ ,
105*4882a593Smuzhiyun                       DDXPointPtr /*ppt */ ,
106*4882a593Smuzhiyun                       int * /*pwidth */ ,
107*4882a593Smuzhiyun                       int /*nspans */ ,
108*4882a593Smuzhiyun                       int /*fSorted */ );
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun     void (*PutImage) (DrawablePtr /*pDrawable */ ,
111*4882a593Smuzhiyun                       GCPtr /*pGC */ ,
112*4882a593Smuzhiyun                       int /*depth */ ,
113*4882a593Smuzhiyun                       int /*x */ ,
114*4882a593Smuzhiyun                       int /*y */ ,
115*4882a593Smuzhiyun                       int /*w */ ,
116*4882a593Smuzhiyun                       int /*h */ ,
117*4882a593Smuzhiyun                       int /*leftPad */ ,
118*4882a593Smuzhiyun                       int /*format */ ,
119*4882a593Smuzhiyun                       char * /*pBits */ );
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun     RegionPtr (*CopyArea) (DrawablePtr /*pSrc */ ,
122*4882a593Smuzhiyun                            DrawablePtr /*pDst */ ,
123*4882a593Smuzhiyun                            GCPtr /*pGC */ ,
124*4882a593Smuzhiyun                            int /*srcx */ ,
125*4882a593Smuzhiyun                            int /*srcy */ ,
126*4882a593Smuzhiyun                            int /*w */ ,
127*4882a593Smuzhiyun                            int /*h */ ,
128*4882a593Smuzhiyun                            int /*dstx */ ,
129*4882a593Smuzhiyun                            int /*dsty */ );
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun     RegionPtr (*CopyPlane) (DrawablePtr /*pSrcDrawable */ ,
132*4882a593Smuzhiyun                             DrawablePtr /*pDstDrawable */ ,
133*4882a593Smuzhiyun                             GCPtr /*pGC */ ,
134*4882a593Smuzhiyun                             int /*srcx */ ,
135*4882a593Smuzhiyun                             int /*srcy */ ,
136*4882a593Smuzhiyun                             int /*width */ ,
137*4882a593Smuzhiyun                             int /*height */ ,
138*4882a593Smuzhiyun                             int /*dstx */ ,
139*4882a593Smuzhiyun                             int /*dsty */ ,
140*4882a593Smuzhiyun                             unsigned long /*bitPlane */ );
141*4882a593Smuzhiyun     void (*PolyPoint) (DrawablePtr /*pDrawable */ ,
142*4882a593Smuzhiyun                        GCPtr /*pGC */ ,
143*4882a593Smuzhiyun                        int /*mode */ ,
144*4882a593Smuzhiyun                        int /*npt */ ,
145*4882a593Smuzhiyun                        DDXPointPtr /*pptInit */ );
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun     void (*Polylines) (DrawablePtr /*pDrawable */ ,
148*4882a593Smuzhiyun                        GCPtr /*pGC */ ,
149*4882a593Smuzhiyun                        int /*mode */ ,
150*4882a593Smuzhiyun                        int /*npt */ ,
151*4882a593Smuzhiyun                        DDXPointPtr /*pptInit */ );
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun     void (*PolySegment) (DrawablePtr /*pDrawable */ ,
154*4882a593Smuzhiyun                          GCPtr /*pGC */ ,
155*4882a593Smuzhiyun                          int /*nseg */ ,
156*4882a593Smuzhiyun                          xSegment * /*pSegs */ );
157*4882a593Smuzhiyun 
158*4882a593Smuzhiyun     void (*PolyRectangle) (DrawablePtr /*pDrawable */ ,
159*4882a593Smuzhiyun                            GCPtr /*pGC */ ,
160*4882a593Smuzhiyun                            int /*nrects */ ,
161*4882a593Smuzhiyun                            xRectangle * /*pRects */ );
162*4882a593Smuzhiyun 
163*4882a593Smuzhiyun     void (*PolyArc) (DrawablePtr /*pDrawable */ ,
164*4882a593Smuzhiyun                      GCPtr /*pGC */ ,
165*4882a593Smuzhiyun                      int /*narcs */ ,
166*4882a593Smuzhiyun                      xArc * /*parcs */ );
167*4882a593Smuzhiyun 
168*4882a593Smuzhiyun     void (*FillPolygon) (DrawablePtr /*pDrawable */ ,
169*4882a593Smuzhiyun                          GCPtr /*pGC */ ,
170*4882a593Smuzhiyun                          int /*shape */ ,
171*4882a593Smuzhiyun                          int /*mode */ ,
172*4882a593Smuzhiyun                          int /*count */ ,
173*4882a593Smuzhiyun                          DDXPointPtr /*pPts */ );
174*4882a593Smuzhiyun 
175*4882a593Smuzhiyun     void (*PolyFillRect) (DrawablePtr /*pDrawable */ ,
176*4882a593Smuzhiyun                           GCPtr /*pGC */ ,
177*4882a593Smuzhiyun                           int /*nrectFill */ ,
178*4882a593Smuzhiyun                           xRectangle * /*prectInit */ );
179*4882a593Smuzhiyun 
180*4882a593Smuzhiyun     void (*PolyFillArc) (DrawablePtr /*pDrawable */ ,
181*4882a593Smuzhiyun                          GCPtr /*pGC */ ,
182*4882a593Smuzhiyun                          int /*narcs */ ,
183*4882a593Smuzhiyun                          xArc * /*parcs */ );
184*4882a593Smuzhiyun 
185*4882a593Smuzhiyun     int (*PolyText8) (DrawablePtr /*pDrawable */ ,
186*4882a593Smuzhiyun                       GCPtr /*pGC */ ,
187*4882a593Smuzhiyun                       int /*x */ ,
188*4882a593Smuzhiyun                       int /*y */ ,
189*4882a593Smuzhiyun                       int /*count */ ,
190*4882a593Smuzhiyun                       char * /*chars */ );
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun     int (*PolyText16) (DrawablePtr /*pDrawable */ ,
193*4882a593Smuzhiyun                        GCPtr /*pGC */ ,
194*4882a593Smuzhiyun                        int /*x */ ,
195*4882a593Smuzhiyun                        int /*y */ ,
196*4882a593Smuzhiyun                        int /*count */ ,
197*4882a593Smuzhiyun                        unsigned short * /*chars */ );
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun     void (*ImageText8) (DrawablePtr /*pDrawable */ ,
200*4882a593Smuzhiyun                         GCPtr /*pGC */ ,
201*4882a593Smuzhiyun                         int /*x */ ,
202*4882a593Smuzhiyun                         int /*y */ ,
203*4882a593Smuzhiyun                         int /*count */ ,
204*4882a593Smuzhiyun                         char * /*chars */ );
205*4882a593Smuzhiyun 
206*4882a593Smuzhiyun     void (*ImageText16) (DrawablePtr /*pDrawable */ ,
207*4882a593Smuzhiyun                          GCPtr /*pGC */ ,
208*4882a593Smuzhiyun                          int /*x */ ,
209*4882a593Smuzhiyun                          int /*y */ ,
210*4882a593Smuzhiyun                          int /*count */ ,
211*4882a593Smuzhiyun                          unsigned short * /*chars */ );
212*4882a593Smuzhiyun 
213*4882a593Smuzhiyun     void (*ImageGlyphBlt) (DrawablePtr pDrawable,
214*4882a593Smuzhiyun                            GCPtr pGC,
215*4882a593Smuzhiyun                            int x,
216*4882a593Smuzhiyun                            int y,
217*4882a593Smuzhiyun                            unsigned int nglyph,
218*4882a593Smuzhiyun                            CharInfoPtr *ppci,
219*4882a593Smuzhiyun                            void *pglyphBase);
220*4882a593Smuzhiyun 
221*4882a593Smuzhiyun     void (*PolyGlyphBlt) (DrawablePtr pDrawable,
222*4882a593Smuzhiyun                           GCPtr pGC,
223*4882a593Smuzhiyun                           int x,
224*4882a593Smuzhiyun                           int y,
225*4882a593Smuzhiyun                           unsigned int nglyph,
226*4882a593Smuzhiyun                           CharInfoPtr *ppci,
227*4882a593Smuzhiyun                           void *pglyphBase);
228*4882a593Smuzhiyun 
229*4882a593Smuzhiyun     void (*PushPixels) (GCPtr /*pGC */ ,
230*4882a593Smuzhiyun                         PixmapPtr /*pBitMap */ ,
231*4882a593Smuzhiyun                         DrawablePtr /*pDst */ ,
232*4882a593Smuzhiyun                         int /*w */ ,
233*4882a593Smuzhiyun                         int /*h */ ,
234*4882a593Smuzhiyun                         int /*x */ ,
235*4882a593Smuzhiyun                         int /*y */ );
236*4882a593Smuzhiyun } GCOps;
237*4882a593Smuzhiyun 
238*4882a593Smuzhiyun /* there is padding in the bit fields because the Sun compiler doesn't
239*4882a593Smuzhiyun  * force alignment to 32-bit boundaries.  losers.
240*4882a593Smuzhiyun  */
241*4882a593Smuzhiyun typedef struct _GC {
242*4882a593Smuzhiyun     ScreenPtr pScreen;
243*4882a593Smuzhiyun     unsigned char depth;
244*4882a593Smuzhiyun     unsigned char alu;
245*4882a593Smuzhiyun     unsigned short lineWidth;
246*4882a593Smuzhiyun     unsigned short dashOffset;
247*4882a593Smuzhiyun     unsigned short numInDashList;
248*4882a593Smuzhiyun     unsigned char *dash;
249*4882a593Smuzhiyun     unsigned int lineStyle:2;
250*4882a593Smuzhiyun     unsigned int capStyle:2;
251*4882a593Smuzhiyun     unsigned int joinStyle:2;
252*4882a593Smuzhiyun     unsigned int fillStyle:2;
253*4882a593Smuzhiyun     unsigned int fillRule:1;
254*4882a593Smuzhiyun     unsigned int arcMode:1;
255*4882a593Smuzhiyun     unsigned int subWindowMode:1;
256*4882a593Smuzhiyun     unsigned int graphicsExposures:1;
257*4882a593Smuzhiyun     unsigned int miTranslate:1; /* should mi things translate? */
258*4882a593Smuzhiyun     unsigned int tileIsPixel:1; /* tile is solid pixel */
259*4882a593Smuzhiyun     unsigned int fExpose:1;     /* Call exposure handling */
260*4882a593Smuzhiyun     unsigned int freeCompClip:1;        /* Free composite clip */
261*4882a593Smuzhiyun     unsigned int scratch_inuse:1;       /* is this GC in a pool for reuse? */
262*4882a593Smuzhiyun     unsigned int unused:15;     /* see comment above */
263*4882a593Smuzhiyun     unsigned int planemask;
264*4882a593Smuzhiyun     unsigned int fgPixel;
265*4882a593Smuzhiyun     unsigned int bgPixel;
266*4882a593Smuzhiyun     /*
267*4882a593Smuzhiyun      * alas -- both tile and stipple must be here as they
268*4882a593Smuzhiyun      * are independently specifiable
269*4882a593Smuzhiyun      */
270*4882a593Smuzhiyun     PixUnion tile;
271*4882a593Smuzhiyun     PixmapPtr stipple;
272*4882a593Smuzhiyun     DDXPointRec patOrg;         /* origin for (tile, stipple) */
273*4882a593Smuzhiyun     DDXPointRec clipOrg;
274*4882a593Smuzhiyun     struct _Font *font;
275*4882a593Smuzhiyun     RegionPtr clientClip;
276*4882a593Smuzhiyun     unsigned int stateChanges; /* masked with GC_<kind> */
277*4882a593Smuzhiyun     unsigned int serialNumber;
278*4882a593Smuzhiyun     const GCFuncs *funcs;
279*4882a593Smuzhiyun     const GCOps *ops;
280*4882a593Smuzhiyun     PrivateRec *devPrivates;
281*4882a593Smuzhiyun     RegionPtr pCompositeClip;
282*4882a593Smuzhiyun } GC;
283*4882a593Smuzhiyun 
284*4882a593Smuzhiyun #endif                          /* GCSTRUCT_H */
285