1 | /*
|
---|
2 | * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.22 2002/11/23 02:38:15 keithp Exp $
|
---|
3 | *
|
---|
4 | * Copyright © 2000 SuSE, 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 SuSE not be used in advertising or
|
---|
11 | * publicity pertaining to distribution of the software without specific,
|
---|
12 | * written prior permission. SuSE makes no representations about the
|
---|
13 | * suitability of this software for any purpose. It is provided "as is"
|
---|
14 | * without express or implied warranty.
|
---|
15 | *
|
---|
16 | * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
---|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
---|
18 | * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
19 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
---|
20 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
---|
21 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
22 | *
|
---|
23 | * Author: Keith Packard, SuSE, Inc.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef _PICTURESTR_H_
|
---|
27 | #define _PICTURESTR_H_
|
---|
28 |
|
---|
29 | #include "glyphstr.h"
|
---|
30 | #include "scrnintstr.h"
|
---|
31 | #include "resource.h"
|
---|
32 |
|
---|
33 | typedef struct _DirectFormat {
|
---|
34 | CARD16 red, redMask;
|
---|
35 | CARD16 green, greenMask;
|
---|
36 | CARD16 blue, blueMask;
|
---|
37 | CARD16 alpha, alphaMask;
|
---|
38 | } DirectFormatRec;
|
---|
39 |
|
---|
40 | typedef struct _IndexFormat {
|
---|
41 | VisualPtr pVisual;
|
---|
42 | ColormapPtr pColormap;
|
---|
43 | int nvalues;
|
---|
44 | xIndexValue *pValues;
|
---|
45 | void *devPrivate;
|
---|
46 | } IndexFormatRec;
|
---|
47 |
|
---|
48 | typedef struct _PictFormat {
|
---|
49 | CARD32 id;
|
---|
50 | CARD32 format; /* except bpp */
|
---|
51 | unsigned char type;
|
---|
52 | unsigned char depth;
|
---|
53 | DirectFormatRec direct;
|
---|
54 | IndexFormatRec index;
|
---|
55 | } PictFormatRec;
|
---|
56 |
|
---|
57 | typedef struct _PictVector {
|
---|
58 | xFixed vector[3];
|
---|
59 | } PictVector, *PictVectorPtr;
|
---|
60 |
|
---|
61 | typedef struct _PictTransform {
|
---|
62 | xFixed matrix[3][3];
|
---|
63 | } PictTransform, *PictTransformPtr;
|
---|
64 |
|
---|
65 | typedef struct _Picture {
|
---|
66 | DrawablePtr pDrawable;
|
---|
67 | PictFormatPtr pFormat;
|
---|
68 | CARD32 format; /* PICT_FORMAT */
|
---|
69 | int refcnt;
|
---|
70 | CARD32 id;
|
---|
71 | PicturePtr pNext; /* chain on same drawable */
|
---|
72 |
|
---|
73 | unsigned int repeat : 1;
|
---|
74 | unsigned int graphicsExposures : 1;
|
---|
75 | unsigned int subWindowMode : 1;
|
---|
76 | unsigned int polyEdge : 1;
|
---|
77 | unsigned int polyMode : 1;
|
---|
78 | unsigned int freeCompClip : 1;
|
---|
79 | unsigned int clientClipType : 2;
|
---|
80 | unsigned int componentAlpha : 1;
|
---|
81 | unsigned int unused : 23;
|
---|
82 |
|
---|
83 | PicturePtr alphaMap;
|
---|
84 | DDXPointRec alphaOrigin;
|
---|
85 |
|
---|
86 | DDXPointRec clipOrigin;
|
---|
87 | pointer clientClip;
|
---|
88 |
|
---|
89 | Atom dither;
|
---|
90 |
|
---|
91 | unsigned long stateChanges;
|
---|
92 | unsigned long serialNumber;
|
---|
93 |
|
---|
94 | RegionPtr pCompositeClip;
|
---|
95 |
|
---|
96 | DevUnion *devPrivates;
|
---|
97 |
|
---|
98 | PictTransform *transform;
|
---|
99 |
|
---|
100 | int filter;
|
---|
101 | xFixed *filter_params;
|
---|
102 | int filter_nparams;
|
---|
103 | } PictureRec;
|
---|
104 |
|
---|
105 | typedef struct {
|
---|
106 | char *name;
|
---|
107 | xFixed *params;
|
---|
108 | int nparams;
|
---|
109 | int id;
|
---|
110 | } PictFilterRec, *PictFilterPtr;
|
---|
111 |
|
---|
112 | #define PictFilterNearest 0
|
---|
113 | #define PictFilterBilinear 1
|
---|
114 |
|
---|
115 | #define PictFilterFast 2
|
---|
116 | #define PictFilterGood 3
|
---|
117 | #define PictFilterBest 4
|
---|
118 |
|
---|
119 | typedef struct {
|
---|
120 | char *alias;
|
---|
121 | int alias_id;
|
---|
122 | int filter_id;
|
---|
123 | } PictFilterAliasRec, *PictFilterAliasPtr;
|
---|
124 |
|
---|
125 | typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
|
---|
126 | typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
|
---|
127 | typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
|
---|
128 | int clipType,
|
---|
129 | pointer value,
|
---|
130 | int n);
|
---|
131 | typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture);
|
---|
132 |
|
---|
133 | typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
|
---|
134 | PictTransform *transform);
|
---|
135 |
|
---|
136 | typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
|
---|
137 | int filter,
|
---|
138 | xFixed *params,
|
---|
139 | int nparams);
|
---|
140 |
|
---|
141 | typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
|
---|
142 |
|
---|
143 | typedef void (*ChangePictureProcPtr) (PicturePtr pPicture,
|
---|
144 | Mask mask);
|
---|
145 | typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture,
|
---|
146 | Mask mask);
|
---|
147 | typedef void (*CompositeProcPtr) (CARD8 op,
|
---|
148 | PicturePtr pSrc,
|
---|
149 | PicturePtr pMask,
|
---|
150 | PicturePtr pDst,
|
---|
151 | INT16 xSrc,
|
---|
152 | INT16 ySrc,
|
---|
153 | INT16 xMask,
|
---|
154 | INT16 yMask,
|
---|
155 | INT16 xDst,
|
---|
156 | INT16 yDst,
|
---|
157 | CARD16 width,
|
---|
158 | CARD16 height);
|
---|
159 |
|
---|
160 | typedef void (*GlyphsProcPtr) (CARD8 op,
|
---|
161 | PicturePtr pSrc,
|
---|
162 | PicturePtr pDst,
|
---|
163 | PictFormatPtr maskFormat,
|
---|
164 | INT16 xSrc,
|
---|
165 | INT16 ySrc,
|
---|
166 | int nlists,
|
---|
167 | GlyphListPtr lists,
|
---|
168 | GlyphPtr *glyphs);
|
---|
169 |
|
---|
170 | typedef void (*CompositeRectsProcPtr) (CARD8 op,
|
---|
171 | PicturePtr pDst,
|
---|
172 | xRenderColor *color,
|
---|
173 | int nRect,
|
---|
174 | xRectangle *rects);
|
---|
175 |
|
---|
176 | typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask,
|
---|
177 | xTrapezoid *trap,
|
---|
178 | int x_off,
|
---|
179 | int y_off);
|
---|
180 |
|
---|
181 | typedef void (*TrapezoidsProcPtr) (CARD8 op,
|
---|
182 | PicturePtr pSrc,
|
---|
183 | PicturePtr pDst,
|
---|
184 | PictFormatPtr maskFormat,
|
---|
185 | INT16 xSrc,
|
---|
186 | INT16 ySrc,
|
---|
187 | int ntrap,
|
---|
188 | xTrapezoid *traps);
|
---|
189 |
|
---|
190 | typedef void (*TrianglesProcPtr) (CARD8 op,
|
---|
191 | PicturePtr pSrc,
|
---|
192 | PicturePtr pDst,
|
---|
193 | PictFormatPtr maskFormat,
|
---|
194 | INT16 xSrc,
|
---|
195 | INT16 ySrc,
|
---|
196 | int ntri,
|
---|
197 | xTriangle *tris);
|
---|
198 |
|
---|
199 | typedef void (*TriStripProcPtr) (CARD8 op,
|
---|
200 | PicturePtr pSrc,
|
---|
201 | PicturePtr pDst,
|
---|
202 | PictFormatPtr maskFormat,
|
---|
203 | INT16 xSrc,
|
---|
204 | INT16 ySrc,
|
---|
205 | int npoint,
|
---|
206 | xPointFixed *points);
|
---|
207 |
|
---|
208 | typedef void (*TriFanProcPtr) (CARD8 op,
|
---|
209 | PicturePtr pSrc,
|
---|
210 | PicturePtr pDst,
|
---|
211 | PictFormatPtr maskFormat,
|
---|
212 | INT16 xSrc,
|
---|
213 | INT16 ySrc,
|
---|
214 | int npoint,
|
---|
215 | xPointFixed *points);
|
---|
216 |
|
---|
217 | typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen,
|
---|
218 | PictFormatPtr pFormat);
|
---|
219 |
|
---|
220 | typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen,
|
---|
221 | PictFormatPtr pFormat);
|
---|
222 |
|
---|
223 | typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
|
---|
224 | PictFormatPtr pFormat,
|
---|
225 | int ndef,
|
---|
226 | xColorItem *pdef);
|
---|
227 |
|
---|
228 | typedef struct _PictureScreen {
|
---|
229 | int totalPictureSize;
|
---|
230 | unsigned int *PicturePrivateSizes;
|
---|
231 | int PicturePrivateLen;
|
---|
232 |
|
---|
233 | PictFormatPtr formats;
|
---|
234 | PictFormatPtr fallback;
|
---|
235 | int nformats;
|
---|
236 |
|
---|
237 | CreatePictureProcPtr CreatePicture;
|
---|
238 | DestroyPictureProcPtr DestroyPicture;
|
---|
239 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
240 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
241 |
|
---|
242 | ChangePictureProcPtr ChangePicture;
|
---|
243 | ValidatePictureProcPtr ValidatePicture;
|
---|
244 |
|
---|
245 | CompositeProcPtr Composite;
|
---|
246 | GlyphsProcPtr Glyphs;
|
---|
247 | CompositeRectsProcPtr CompositeRects;
|
---|
248 |
|
---|
249 | DestroyWindowProcPtr DestroyWindow;
|
---|
250 | CloseScreenProcPtr CloseScreen;
|
---|
251 |
|
---|
252 | StoreColorsProcPtr StoreColors;
|
---|
253 |
|
---|
254 | InitIndexedProcPtr InitIndexed;
|
---|
255 | CloseIndexedProcPtr CloseIndexed;
|
---|
256 | UpdateIndexedProcPtr UpdateIndexed;
|
---|
257 |
|
---|
258 | int subpixel;
|
---|
259 |
|
---|
260 | PictFilterPtr filters;
|
---|
261 | int nfilters;
|
---|
262 | PictFilterAliasPtr filterAliases;
|
---|
263 | int nfilterAliases;
|
---|
264 |
|
---|
265 | ChangePictureTransformProcPtr ChangePictureTransform;
|
---|
266 | ChangePictureFilterProcPtr ChangePictureFilter;
|
---|
267 | DestroyPictureFilterProcPtr DestroyPictureFilter;
|
---|
268 |
|
---|
269 | TrapezoidsProcPtr Trapezoids;
|
---|
270 | TrianglesProcPtr Triangles;
|
---|
271 | TriStripProcPtr TriStrip;
|
---|
272 | TriFanProcPtr TriFan;
|
---|
273 |
|
---|
274 | RasterizeTrapezoidProcPtr RasterizeTrapezoid;
|
---|
275 | } PictureScreenRec, *PictureScreenPtr;
|
---|
276 |
|
---|
277 | extern int PictureScreenPrivateIndex;
|
---|
278 | extern int PictureWindowPrivateIndex;
|
---|
279 | extern RESTYPE PictureType;
|
---|
280 | extern RESTYPE PictFormatType;
|
---|
281 | extern RESTYPE GlyphSetType;
|
---|
282 |
|
---|
283 | #define GetPictureScreen(s) ((PictureScreenPtr) ((s)->devPrivates[PictureScreenPrivateIndex].ptr))
|
---|
284 | #define GetPictureScreenIfSet(s) ((PictureScreenPrivateIndex != -1) ? GetPictureScreen(s) : NULL)
|
---|
285 | #define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (pointer) (p))
|
---|
286 | #define GetPictureWindow(w) ((PicturePtr) ((w)->devPrivates[PictureWindowPrivateIndex].ptr))
|
---|
287 | #define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (pointer) (p))
|
---|
288 |
|
---|
289 | #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
|
---|
290 | pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\
|
---|
291 | if (!pPicture) { \
|
---|
292 | client->errorValue = pid; \
|
---|
293 | return err; \
|
---|
294 | } \
|
---|
295 | }
|
---|
296 |
|
---|
297 | #define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
|
---|
298 | if (pid == None) \
|
---|
299 | pPicture = 0; \
|
---|
300 | else { \
|
---|
301 | VERIFY_PICTURE(pPicture, pid, client, mode, err); \
|
---|
302 | } \
|
---|
303 | } \
|
---|
304 |
|
---|
305 | Bool
|
---|
306 | PictureDestroyWindow (WindowPtr pWindow);
|
---|
307 |
|
---|
308 | Bool
|
---|
309 | PictureCloseScreen (int Index, ScreenPtr pScreen);
|
---|
310 |
|
---|
311 | void
|
---|
312 | PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
|
---|
313 |
|
---|
314 | Bool
|
---|
315 | PictureInitIndexedFormats (ScreenPtr pScreen);
|
---|
316 |
|
---|
317 | Bool
|
---|
318 | PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
|
---|
319 |
|
---|
320 | int
|
---|
321 | PictureGetSubpixelOrder (ScreenPtr pScreen);
|
---|
322 |
|
---|
323 | PictFormatPtr
|
---|
324 | PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
|
---|
325 |
|
---|
326 | PictFormatPtr
|
---|
327 | PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual);
|
---|
328 |
|
---|
329 | PictFormatPtr
|
---|
330 | PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format);
|
---|
331 |
|
---|
332 | Bool
|
---|
333 | PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
|
---|
334 |
|
---|
335 | int
|
---|
336 | PictureGetFilterId (char *filter, int len, Bool makeit);
|
---|
337 |
|
---|
338 | char *
|
---|
339 | PictureGetFilterName (int id);
|
---|
340 |
|
---|
341 | int
|
---|
342 | PictureAddFilter (ScreenPtr pScreen, char *filter, xFixed *params, int nparams);
|
---|
343 |
|
---|
344 | Bool
|
---|
345 | PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias);
|
---|
346 |
|
---|
347 | Bool
|
---|
348 | PictureSetDefaultFilters (ScreenPtr pScreen);
|
---|
349 |
|
---|
350 | void
|
---|
351 | PictureResetFilters (ScreenPtr pScreen);
|
---|
352 |
|
---|
353 | PictFilterPtr
|
---|
354 | PictureFindFilter (ScreenPtr pScreen, char *name, int len);
|
---|
355 |
|
---|
356 | int
|
---|
357 | SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams);
|
---|
358 |
|
---|
359 | Bool
|
---|
360 | PictureFinishInit (void);
|
---|
361 |
|
---|
362 | void
|
---|
363 | SetPictureToDefaults (PicturePtr pPicture);
|
---|
364 |
|
---|
365 | PicturePtr
|
---|
366 | AllocatePicture (ScreenPtr pScreen);
|
---|
367 |
|
---|
368 | #if 0
|
---|
369 | Bool
|
---|
370 | miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
|
---|
371 | #endif
|
---|
372 |
|
---|
373 |
|
---|
374 | PicturePtr
|
---|
375 | CreatePicture (Picture pid,
|
---|
376 | DrawablePtr pDrawable,
|
---|
377 | PictFormatPtr pFormat,
|
---|
378 | Mask mask,
|
---|
379 | XID *list,
|
---|
380 | ClientPtr client,
|
---|
381 | int *error);
|
---|
382 |
|
---|
383 | int
|
---|
384 | ChangePicture (PicturePtr pPicture,
|
---|
385 | Mask vmask,
|
---|
386 | XID *vlist,
|
---|
387 | DevUnion *ulist,
|
---|
388 | ClientPtr client);
|
---|
389 |
|
---|
390 | int
|
---|
391 | SetPictureClipRects (PicturePtr pPicture,
|
---|
392 | int xOrigin,
|
---|
393 | int yOrigin,
|
---|
394 | int nRect,
|
---|
395 | xRectangle *rects);
|
---|
396 |
|
---|
397 | int
|
---|
398 | SetPictureTransform (PicturePtr pPicture,
|
---|
399 | PictTransform *transform);
|
---|
400 |
|
---|
401 | void
|
---|
402 | ValidatePicture(PicturePtr pPicture);
|
---|
403 |
|
---|
404 | int
|
---|
405 | FreePicture (pointer pPicture,
|
---|
406 | XID pid);
|
---|
407 |
|
---|
408 | int
|
---|
409 | FreePictFormat (pointer pPictFormat,
|
---|
410 | XID pid);
|
---|
411 |
|
---|
412 | void
|
---|
413 | CompositePicture (CARD8 op,
|
---|
414 | PicturePtr pSrc,
|
---|
415 | PicturePtr pMask,
|
---|
416 | PicturePtr pDst,
|
---|
417 | INT16 xSrc,
|
---|
418 | INT16 ySrc,
|
---|
419 | INT16 xMask,
|
---|
420 | INT16 yMask,
|
---|
421 | INT16 xDst,
|
---|
422 | INT16 yDst,
|
---|
423 | CARD16 width,
|
---|
424 | CARD16 height);
|
---|
425 |
|
---|
426 | void
|
---|
427 | CompositeGlyphs (CARD8 op,
|
---|
428 | PicturePtr pSrc,
|
---|
429 | PicturePtr pDst,
|
---|
430 | PictFormatPtr maskFormat,
|
---|
431 | INT16 xSrc,
|
---|
432 | INT16 ySrc,
|
---|
433 | int nlist,
|
---|
434 | GlyphListPtr lists,
|
---|
435 | GlyphPtr *glyphs);
|
---|
436 |
|
---|
437 | void
|
---|
438 | CompositeRects (CARD8 op,
|
---|
439 | PicturePtr pDst,
|
---|
440 | xRenderColor *color,
|
---|
441 | int nRect,
|
---|
442 | xRectangle *rects);
|
---|
443 |
|
---|
444 | void
|
---|
445 | CompositeTrapezoids (CARD8 op,
|
---|
446 | PicturePtr pSrc,
|
---|
447 | PicturePtr pDst,
|
---|
448 | PictFormatPtr maskFormat,
|
---|
449 | INT16 xSrc,
|
---|
450 | INT16 ySrc,
|
---|
451 | int ntrap,
|
---|
452 | xTrapezoid *traps);
|
---|
453 |
|
---|
454 | void
|
---|
455 | CompositeTriangles (CARD8 op,
|
---|
456 | PicturePtr pSrc,
|
---|
457 | PicturePtr pDst,
|
---|
458 | PictFormatPtr maskFormat,
|
---|
459 | INT16 xSrc,
|
---|
460 | INT16 ySrc,
|
---|
461 | int ntriangles,
|
---|
462 | xTriangle *triangles);
|
---|
463 |
|
---|
464 | void
|
---|
465 | CompositeTriStrip (CARD8 op,
|
---|
466 | PicturePtr pSrc,
|
---|
467 | PicturePtr pDst,
|
---|
468 | PictFormatPtr maskFormat,
|
---|
469 | INT16 xSrc,
|
---|
470 | INT16 ySrc,
|
---|
471 | int npoints,
|
---|
472 | xPointFixed *points);
|
---|
473 |
|
---|
474 | void
|
---|
475 | CompositeTriFan (CARD8 op,
|
---|
476 | PicturePtr pSrc,
|
---|
477 | PicturePtr pDst,
|
---|
478 | PictFormatPtr maskFormat,
|
---|
479 | INT16 xSrc,
|
---|
480 | INT16 ySrc,
|
---|
481 | int npoints,
|
---|
482 | xPointFixed *points);
|
---|
483 |
|
---|
484 | Bool
|
---|
485 | PictureTransformPoint (PictTransformPtr transform,
|
---|
486 | PictVectorPtr vector);
|
---|
487 |
|
---|
488 | void RenderExtensionInit (void);
|
---|
489 |
|
---|
490 | Bool
|
---|
491 | AnimCurInit (ScreenPtr pScreen);
|
---|
492 |
|
---|
493 | int
|
---|
494 | AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor);
|
---|
495 |
|
---|
496 | #ifdef PANORAMIX
|
---|
497 | void PanoramiXRenderInit (void);
|
---|
498 | void PanoramiXRenderReset (void);
|
---|
499 | #endif
|
---|
500 |
|
---|
501 | #endif /* _PICTURESTR_H_ */
|
---|