1 | /*
|
---|
2 | * $XFree86: xc/programs/Xserver/miext/layer/layerstr.h,v 1.2 2001/06/04 09:45:41 keithp Exp $
|
---|
3 | *
|
---|
4 | * Copyright © 2001 Keith Packard, member of The XFree86 Project, Inc.
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
7 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
8 | * the above copyright notice appear in all copies and that both that
|
---|
9 | * copyright notice and this permission notice appear in supporting
|
---|
10 | * documentation, and that the name of Keith Packard not be used in
|
---|
11 | * advertising or publicity pertaining to distribution of the software without
|
---|
12 | * specific, written prior permission. Keith Packard makes no
|
---|
13 | * representations about the suitability of this software for any purpose. It
|
---|
14 | * is provided "as is" without express or implied warranty.
|
---|
15 | *
|
---|
16 | * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
17 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
18 | * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
19 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
20 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
21 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
22 | * PERFORMANCE OF THIS SOFTWARE.
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifdef HAVE_DIX_CONFIG_H
|
---|
26 | #include <dix-config.h>
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | #ifndef _LAYERSTR_H_
|
---|
30 | #define _LAYERSTR_H_
|
---|
31 |
|
---|
32 | #include <X11/X.h>
|
---|
33 | #include "scrnintstr.h"
|
---|
34 | #include "windowstr.h"
|
---|
35 | #include <X11/fonts/font.h>
|
---|
36 | #include "dixfontstr.h"
|
---|
37 | #include <X11/fonts/fontstruct.h>
|
---|
38 | #include "mi.h"
|
---|
39 | #include "regionstr.h"
|
---|
40 | #include "globals.h"
|
---|
41 | #include "gcstruct.h"
|
---|
42 | #include "layer.h"
|
---|
43 | #ifdef RENDER
|
---|
44 | #include "picturestr.h"
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | extern int layerScrPrivateIndex;
|
---|
48 | extern int layerGCPrivateIndex;
|
---|
49 | extern int layerWinPrivateIndex;
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * One of these for each possible set of underlying
|
---|
53 | * rendering code. The first kind always points at the
|
---|
54 | * underlying frame buffer code and is created in LayerStartInit
|
---|
55 | * so that LayerNewKind can unwrap the screen and prepare it
|
---|
56 | * for another wrapping sequence.
|
---|
57 | *
|
---|
58 | * The set of functions wrapped here must be at least the union
|
---|
59 | * of all functions wrapped by any rendering layer in use; they're
|
---|
60 | * easy to add, so don't be shy
|
---|
61 | */
|
---|
62 |
|
---|
63 | typedef struct _LayerKind {
|
---|
64 | int kind; /* kind index */
|
---|
65 |
|
---|
66 | CloseScreenProcPtr CloseScreen;
|
---|
67 |
|
---|
68 | CreateWindowProcPtr CreateWindow;
|
---|
69 | DestroyWindowProcPtr DestroyWindow;
|
---|
70 | ChangeWindowAttributesProcPtr ChangeWindowAttributes;
|
---|
71 | PaintWindowBackgroundProcPtr PaintWindowBackground;
|
---|
72 | PaintWindowBorderProcPtr PaintWindowBorder;
|
---|
73 | CopyWindowProcPtr CopyWindow;
|
---|
74 |
|
---|
75 | CreatePixmapProcPtr CreatePixmap;
|
---|
76 | DestroyPixmapProcPtr DestroyPixmap;
|
---|
77 |
|
---|
78 | CreateGCProcPtr CreateGC;
|
---|
79 | #ifdef RENDER
|
---|
80 | CompositeProcPtr Composite;
|
---|
81 | GlyphsProcPtr Glyphs;
|
---|
82 | CompositeRectsProcPtr CompositeRects;
|
---|
83 | #endif
|
---|
84 | } LayerKindRec;
|
---|
85 |
|
---|
86 | #define LayerWrap(orig,lay,member,func) \
|
---|
87 | (((lay)->member = (orig)->member),\
|
---|
88 | ((orig)->member = (func)))
|
---|
89 | #define LayerUnwrap(orig,lay,member) \
|
---|
90 | ((orig)->member = (lay)->member)
|
---|
91 |
|
---|
92 | /*
|
---|
93 | * This is the window private structure allocated for
|
---|
94 | * all windows. There are two possible alternatives here,
|
---|
95 | * either the window belongs to a single layer and uses its
|
---|
96 | * internal clip/borderClip lists or the window belongs to one
|
---|
97 | * or more layers and uses a separate clip/borderclip for each
|
---|
98 | * layer. When this is integrated into the core window struct,
|
---|
99 | * the LayerWinKind can become a single bit saving 8 bytes per
|
---|
100 | * window.
|
---|
101 | */
|
---|
102 |
|
---|
103 | typedef struct _LayerWin {
|
---|
104 | Bool isList;
|
---|
105 | union {
|
---|
106 | LayerPtr pLayer;
|
---|
107 | LayerListPtr pLayList;
|
---|
108 | } u;
|
---|
109 | } LayerWinRec;
|
---|
110 |
|
---|
111 | typedef struct _LayerList {
|
---|
112 | LayerListPtr pNext; /* list of layers for this window */
|
---|
113 | LayerPtr pLayer; /* the layer */
|
---|
114 | Bool inheritClip; /* use the window clipList/borderClip */
|
---|
115 | RegionRec clipList; /* per-layer clip/border clip lists */
|
---|
116 | RegionRec borderClip;
|
---|
117 | } LayerListRec;
|
---|
118 |
|
---|
119 | #define layerGetWinPriv(pWin) ((LayerWinPtr) (pWin)->devPrivates[layerWinPrivateIndex].ptr)
|
---|
120 | #define layerWinPriv(pWin) LayerWinPtr pLayWin = layerGetWinPriv(pWin)
|
---|
121 |
|
---|
122 | #define layerWinLayer(pLayWin) ((pLayWin)->isList ? (pLayWin)->u.pLayList->pLayer : (pLayWin)->u.pLayer)
|
---|
123 |
|
---|
124 | typedef struct _LayerWinLoop {
|
---|
125 | LayerWinPtr pLayWin;
|
---|
126 | LayerListPtr pLayList;
|
---|
127 | PixmapPtr pPixmap; /* original window pixmap */
|
---|
128 | RegionRec clipList; /* saved original clipList contents */
|
---|
129 | RegionRec borderClip; /* saved original borderClip contents */
|
---|
130 | } LayerWinLoopRec, *LayerWinLoopPtr;
|
---|
131 |
|
---|
132 | #define layerWinFirstLayer(pLayWin,pLayList) ((pLayWin)->isList ? ((pLayList) = (pLayWin)->u.pLayList)->pLayer : pLayWin->u.pLayer)
|
---|
133 | #define layerWinNextLayer(pLayWin,pLayList) ((pLayWin)->isList ? ((pLayList) = (pLayList)->pNext)->pLayer : 0)
|
---|
134 |
|
---|
135 | LayerPtr
|
---|
136 | LayerWindowFirst (WindowPtr pWin, LayerWinLoopPtr pLoop);
|
---|
137 |
|
---|
138 | LayerPtr
|
---|
139 | LayerWindowNext (WindowPtr pWin, LayerWinLoopPtr pLoop);
|
---|
140 |
|
---|
141 | void
|
---|
142 | LayerWindowDone (WindowPtr pWin, LayerWinLoopPtr pLoop);
|
---|
143 |
|
---|
144 |
|
---|
145 | /*
|
---|
146 | * This is the GC private structure allocated for all GCs.
|
---|
147 | * XXX this is really messed up; I'm not sure how to fix it yet
|
---|
148 | */
|
---|
149 |
|
---|
150 | typedef struct _LayerGC {
|
---|
151 | GCFuncs *funcs;
|
---|
152 | LayerKindPtr pKind;
|
---|
153 | } LayerGCRec;
|
---|
154 |
|
---|
155 | #define layerGetGCPriv(pGC) ((LayerGCPtr) (pGC)->devPrivates[layerGCPrivateIndex].ptr)
|
---|
156 | #define layerGCPriv(pGC) LayerGCPtr pLayGC = layerGetGCPriv(pGC)
|
---|
157 |
|
---|
158 | /*
|
---|
159 | * This is the screen private, it contains
|
---|
160 | * the layer kinds and the layers themselves
|
---|
161 | */
|
---|
162 | typedef struct _LayerScreen {
|
---|
163 | int nkinds; /* number of elements in kinds array */
|
---|
164 | LayerKindPtr kinds; /* created kinds; reallocated when new ones added */
|
---|
165 | LayerPtr pLayers; /* list of layers for this screen */
|
---|
166 | } LayerScreenRec;
|
---|
167 |
|
---|
168 | #define layerGetScrPriv(pScreen) ((LayerScreenPtr) (pScreen)->devPrivates[layerScrPrivateIndex].ptr)
|
---|
169 | #define layerScrPriv(pScreen) LayerScreenPtr pLayScr = layerGetScrPriv(pScreen)
|
---|
170 |
|
---|
171 | Bool
|
---|
172 | layerCloseScreen (int index, ScreenPtr pScreen);
|
---|
173 |
|
---|
174 | Bool
|
---|
175 | layerCreateWindow (WindowPtr pWin);
|
---|
176 |
|
---|
177 | Bool
|
---|
178 | layerDestroyWindow (WindowPtr pWin);
|
---|
179 |
|
---|
180 | Bool
|
---|
181 | layerChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
|
---|
182 |
|
---|
183 | void
|
---|
184 | layerPaintWindowBackground (WindowPtr pWin, RegionPtr pRegion, int what);
|
---|
185 |
|
---|
186 | void
|
---|
187 | layerPaintWindowBorder (WindowPtr pWin, RegionPtr pRegion, int what);
|
---|
188 |
|
---|
189 | void
|
---|
190 | layerCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
|
---|
191 |
|
---|
192 | PixmapPtr
|
---|
193 | layerCreatePixmap (ScreenPtr pScreen, int width, int height, int depth);
|
---|
194 |
|
---|
195 | Bool
|
---|
196 | layerDestroyPixmap (PixmapPtr pPixmap);
|
---|
197 |
|
---|
198 | Bool
|
---|
199 | layerCreateGC (GCPtr pGC);
|
---|
200 |
|
---|
201 | #ifdef RENDER
|
---|
202 | void
|
---|
203 | layerComposite (CARD8 op,
|
---|
204 | PicturePtr pSrc,
|
---|
205 | PicturePtr pMask,
|
---|
206 | PicturePtr pDst,
|
---|
207 | INT16 xSrc,
|
---|
208 | INT16 ySrc,
|
---|
209 | INT16 xMask,
|
---|
210 | INT16 yMask,
|
---|
211 | INT16 xDst,
|
---|
212 | INT16 yDst,
|
---|
213 | CARD16 width,
|
---|
214 | CARD16 height);
|
---|
215 | void
|
---|
216 | layerGlyphs (CARD8 op,
|
---|
217 | PicturePtr pSrc,
|
---|
218 | PicturePtr pDst,
|
---|
219 | PictFormatPtr maskFormat,
|
---|
220 | INT16 xSrc,
|
---|
221 | INT16 ySrc,
|
---|
222 | int nlist,
|
---|
223 | GlyphListPtr list,
|
---|
224 | GlyphPtr *glyphs);
|
---|
225 |
|
---|
226 | void
|
---|
227 | layerCompositeRects (CARD8 op,
|
---|
228 | PicturePtr pDst,
|
---|
229 | xRenderColor *color,
|
---|
230 | int nRect,
|
---|
231 | xRectangle *rects);
|
---|
232 | #endif
|
---|
233 | void layerValidateGC(GCPtr, unsigned long, DrawablePtr);
|
---|
234 | void layerChangeGC(GCPtr, unsigned long);
|
---|
235 | void layerCopyGC(GCPtr, unsigned long, GCPtr);
|
---|
236 | void layerDestroyGC(GCPtr);
|
---|
237 | void layerChangeClip(GCPtr, int, pointer, int);
|
---|
238 | void layerDestroyClip(GCPtr);
|
---|
239 | void layerCopyClip(GCPtr, GCPtr);
|
---|
240 |
|
---|
241 | void
|
---|
242 | layerFillSpans(DrawablePtr pDraw,
|
---|
243 | GC *pGC,
|
---|
244 | int nInit,
|
---|
245 | DDXPointPtr pptInit,
|
---|
246 | int *pwidthInit,
|
---|
247 | int fSorted);
|
---|
248 |
|
---|
249 | void
|
---|
250 | layerSetSpans(DrawablePtr pDraw,
|
---|
251 | GCPtr pGC,
|
---|
252 | char *pcharsrc,
|
---|
253 | DDXPointPtr pptInit,
|
---|
254 | int *pwidthInit,
|
---|
255 | int nspans,
|
---|
256 | int fSorted);
|
---|
257 |
|
---|
258 | void
|
---|
259 | layerPutImage(
|
---|
260 | DrawablePtr pDraw,
|
---|
261 | GCPtr pGC,
|
---|
262 | int depth,
|
---|
263 | int x, int y, int w, int h,
|
---|
264 | int leftPad,
|
---|
265 | int format,
|
---|
266 | char *pImage
|
---|
267 | );
|
---|
268 |
|
---|
269 | RegionPtr
|
---|
270 | layerCopyArea(
|
---|
271 | DrawablePtr pSrc,
|
---|
272 | DrawablePtr pDst,
|
---|
273 | GC *pGC,
|
---|
274 | int srcx, int srcy,
|
---|
275 | int width, int height,
|
---|
276 | int dstx, int dsty
|
---|
277 | );
|
---|
278 |
|
---|
279 | RegionPtr
|
---|
280 | layerCopyPlane(
|
---|
281 | DrawablePtr pSrc,
|
---|
282 | DrawablePtr pDst,
|
---|
283 | GCPtr pGC,
|
---|
284 | int srcx, int srcy,
|
---|
285 | int width, int height,
|
---|
286 | int dstx, int dsty,
|
---|
287 | unsigned long bitPlane
|
---|
288 | );
|
---|
289 |
|
---|
290 | void
|
---|
291 | layerPolyPoint(
|
---|
292 | DrawablePtr pDraw,
|
---|
293 | GCPtr pGC,
|
---|
294 | int mode,
|
---|
295 | int npt,
|
---|
296 | xPoint *pptInit
|
---|
297 | );
|
---|
298 | void
|
---|
299 | layerPolylines(
|
---|
300 | DrawablePtr pDraw,
|
---|
301 | GCPtr pGC,
|
---|
302 | int mode,
|
---|
303 | int npt,
|
---|
304 | DDXPointPtr pptInit
|
---|
305 | );
|
---|
306 |
|
---|
307 | void
|
---|
308 | layerPolySegment(
|
---|
309 | DrawablePtr pDraw,
|
---|
310 | GCPtr pGC,
|
---|
311 | int nseg,
|
---|
312 | xSegment *pSeg
|
---|
313 | );
|
---|
314 |
|
---|
315 | void
|
---|
316 | layerPolyRectangle(
|
---|
317 | DrawablePtr pDraw,
|
---|
318 | GCPtr pGC,
|
---|
319 | int nRects,
|
---|
320 | xRectangle *pRects
|
---|
321 | );
|
---|
322 |
|
---|
323 | void
|
---|
324 | layerPolyArc(
|
---|
325 | DrawablePtr pDraw,
|
---|
326 | GCPtr pGC,
|
---|
327 | int narcs,
|
---|
328 | xArc *parcs
|
---|
329 | );
|
---|
330 |
|
---|
331 | void
|
---|
332 | layerFillPolygon(
|
---|
333 | DrawablePtr pDraw,
|
---|
334 | GCPtr pGC,
|
---|
335 | int shape,
|
---|
336 | int mode,
|
---|
337 | int count,
|
---|
338 | DDXPointPtr pptInit
|
---|
339 | );
|
---|
340 |
|
---|
341 | void
|
---|
342 | layerPolyFillRect(
|
---|
343 | DrawablePtr pDraw,
|
---|
344 | GCPtr pGC,
|
---|
345 | int nRectsInit,
|
---|
346 | xRectangle *pRectsInit
|
---|
347 | );
|
---|
348 |
|
---|
349 | void
|
---|
350 | layerPolyFillArc(
|
---|
351 | DrawablePtr pDraw,
|
---|
352 | GCPtr pGC,
|
---|
353 | int narcs,
|
---|
354 | xArc *parcs
|
---|
355 | );
|
---|
356 |
|
---|
357 | int
|
---|
358 | layerPolyText8(
|
---|
359 | DrawablePtr pDraw,
|
---|
360 | GCPtr pGC,
|
---|
361 | int x,
|
---|
362 | int y,
|
---|
363 | int count,
|
---|
364 | char *chars
|
---|
365 | );
|
---|
366 |
|
---|
367 | int
|
---|
368 | layerPolyText16(
|
---|
369 | DrawablePtr pDraw,
|
---|
370 | GCPtr pGC,
|
---|
371 | int x,
|
---|
372 | int y,
|
---|
373 | int count,
|
---|
374 | unsigned short *chars
|
---|
375 | );
|
---|
376 |
|
---|
377 | void
|
---|
378 | layerImageText8(
|
---|
379 | DrawablePtr pDraw,
|
---|
380 | GCPtr pGC,
|
---|
381 | int x,
|
---|
382 | int y,
|
---|
383 | int count,
|
---|
384 | char *chars
|
---|
385 | );
|
---|
386 |
|
---|
387 | void
|
---|
388 | layerImageText16(
|
---|
389 | DrawablePtr pDraw,
|
---|
390 | GCPtr pGC,
|
---|
391 | int x,
|
---|
392 | int y,
|
---|
393 | int count,
|
---|
394 | unsigned short *chars
|
---|
395 | );
|
---|
396 |
|
---|
397 | void
|
---|
398 | layerImageGlyphBlt(
|
---|
399 | DrawablePtr pDraw,
|
---|
400 | GCPtr pGC,
|
---|
401 | int x, int y,
|
---|
402 | unsigned int nglyph,
|
---|
403 | CharInfoPtr *ppci,
|
---|
404 | pointer pglyphBase
|
---|
405 | );
|
---|
406 |
|
---|
407 | void
|
---|
408 | layerPolyGlyphBlt(
|
---|
409 | DrawablePtr pDraw,
|
---|
410 | GCPtr pGC,
|
---|
411 | int x, int y,
|
---|
412 | unsigned int nglyph,
|
---|
413 | CharInfoPtr *ppci,
|
---|
414 | pointer pglyphBase
|
---|
415 | );
|
---|
416 |
|
---|
417 | void
|
---|
418 | layerPushPixels(
|
---|
419 | GCPtr pGC,
|
---|
420 | PixmapPtr pBitMap,
|
---|
421 | DrawablePtr pDraw,
|
---|
422 | int dx, int dy, int xOrg, int yOrg
|
---|
423 | );
|
---|
424 |
|
---|
425 | #endif /* _LAYERSTR_H_ */
|
---|