2
* $Id: picturestr.h,v 1.17.4.1 2006/01/18 07:21:43 airlied Exp $
4
* Copyright Ā© 2000 SuSE, Inc.
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.
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.
23
* Author: Keith Packard, SuSE, Inc.
26
#ifndef _PICTURESTR_H_
27
#define _PICTURESTR_H_
30
#include "scrnintstr.h"
33
#define PictTypeOther 0xff
35
typedef struct _DirectFormat {
37
CARD16 green, greenMask;
38
CARD16 blue, blueMask;
39
CARD16 alpha, alphaMask;
42
typedef struct _IndexFormat {
44
ColormapPtr pColormap;
50
typedef struct _PictFormat {
52
CARD32 format; /* except bpp */
55
DirectFormatRec direct;
59
typedef struct _PictVector {
61
} PictVector, *PictVectorPtr;
63
typedef struct _PictTransform {
65
} PictTransform, *PictTransformPtr;
67
typedef void (*DestroySourcePictProcPtr) (PicturePtr pPicture);
69
#define PICT_GRADIENT_STOPTABLE_SIZE 1024
70
#define SourcePictTypeSolidFill 0
71
#define SourcePictTypeLinear 1
72
#define SourcePictTypeRadial 2
73
#define SourcePictTypeConical 3
74
#define SourcePictTypeOther 4
76
#define SourcePictClassUnknown 0
77
#define SourcePictClassHorizontal 1
78
#define SourcePictClassVertical 2
80
typedef struct _PictSource {
84
DestroySourcePictProcPtr Destroy;
85
} PictSourceRec, *PictSourcePtr;
87
typedef struct _PictSolidFill {
91
DestroySourcePictProcPtr Destroy;
93
} PictSolidFill, *PictSolidFillPtr;
95
typedef struct _PictGradientStop {
98
} PictGradientStop, *PictGradientStopPtr;
100
typedef struct _PictGradient {
104
DestroySourcePictProcPtr Destroy;
106
PictGradientStopPtr stops;
110
} PictGradient, *PictGradientPtr;
112
typedef struct _PictLinearGradient {
116
DestroySourcePictProcPtr Destroy;
118
PictGradientStopPtr stops;
124
} PictLinearGradient, *PictLinearGradientPtr;
126
typedef struct _PictRadialGradient {
130
DestroySourcePictProcPtr Destroy;
132
PictGradientStopPtr stops;
147
} PictRadialGradient, *PictRadialGradientPtr;
149
typedef struct _PictConicalGradient {
153
DestroySourcePictProcPtr Destroy;
155
PictGradientStopPtr stops;
161
} PictConicalGradient, *PictConicalGradientPtr;
163
typedef union _SourcePict {
165
PictSourceRec source;
166
PictSolidFill solidFill;
167
PictGradient gradient;
168
PictLinearGradient linear;
169
PictRadialGradient radial;
170
PictConicalGradient conical;
171
} SourcePict, *SourcePictPtr;
173
typedef struct _Picture {
174
DrawablePtr pDrawable;
175
PictFormatPtr pFormat;
176
CARD32 format; /* PICT_FORMAT */
179
PicturePtr pNext; /* chain on same drawable */
181
unsigned int repeat : 1;
182
unsigned int graphicsExposures : 1;
183
unsigned int subWindowMode : 1;
184
unsigned int polyEdge : 1;
185
unsigned int polyMode : 1;
186
unsigned int freeCompClip : 1;
187
unsigned int clientClipType : 2;
188
unsigned int componentAlpha : 1;
189
unsigned int repeatType : 2;
190
unsigned int unused : 21;
193
DDXPointRec alphaOrigin;
195
DDXPointRec clipOrigin;
200
unsigned long stateChanges;
201
unsigned long serialNumber;
203
RegionPtr pCompositeClip;
205
DevUnion *devPrivates;
207
PictTransform *transform;
210
xFixed *filter_params;
212
SourcePictPtr pSourcePict;
215
typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id,
216
xFixed *params, int nparams);
220
PictFilterValidateParamsProcPtr ValidateParams;
221
} PictFilterRec, *PictFilterPtr;
223
#define PictFilterNearest 0
224
#define PictFilterBilinear 1
226
#define PictFilterFast 2
227
#define PictFilterGood 3
228
#define PictFilterBest 4
230
#define PictFilterConvolution 5
236
} PictFilterAliasRec, *PictFilterAliasPtr;
238
typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
239
typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
240
typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
244
typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture);
246
typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
247
PictTransform *transform);
249
typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
254
typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
256
typedef void (*ChangePictureProcPtr) (PicturePtr pPicture,
258
typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture,
260
typedef void (*CompositeProcPtr) (CARD8 op,
273
typedef void (*GlyphsProcPtr) (CARD8 op,
276
PictFormatPtr maskFormat,
283
typedef void (*CompositeRectsProcPtr) (CARD8 op,
289
typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask,
294
typedef void (*TrapezoidsProcPtr) (CARD8 op,
297
PictFormatPtr maskFormat,
303
typedef void (*TrianglesProcPtr) (CARD8 op,
306
PictFormatPtr maskFormat,
312
typedef void (*TriStripProcPtr) (CARD8 op,
315
PictFormatPtr maskFormat,
319
xPointFixed *points);
321
typedef void (*TriFanProcPtr) (CARD8 op,
324
PictFormatPtr maskFormat,
328
xPointFixed *points);
330
typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen,
331
PictFormatPtr pFormat);
333
typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen,
334
PictFormatPtr pFormat);
336
typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
337
PictFormatPtr pFormat,
341
typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
347
typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
353
typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen,
356
typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen,
359
typedef struct _PictureScreen {
360
int totalPictureSize;
361
unsigned int *PicturePrivateSizes;
362
int PicturePrivateLen;
364
PictFormatPtr formats;
365
PictFormatPtr fallback;
368
CreatePictureProcPtr CreatePicture;
369
DestroyPictureProcPtr DestroyPicture;
370
ChangePictureClipProcPtr ChangePictureClip;
371
DestroyPictureClipProcPtr DestroyPictureClip;
373
ChangePictureProcPtr ChangePicture;
374
ValidatePictureProcPtr ValidatePicture;
376
CompositeProcPtr Composite;
377
GlyphsProcPtr Glyphs;
378
CompositeRectsProcPtr CompositeRects;
380
DestroyWindowProcPtr DestroyWindow;
381
CloseScreenProcPtr CloseScreen;
383
StoreColorsProcPtr StoreColors;
385
InitIndexedProcPtr InitIndexed;
386
CloseIndexedProcPtr CloseIndexed;
387
UpdateIndexedProcPtr UpdateIndexed;
391
PictFilterPtr filters;
393
PictFilterAliasPtr filterAliases;
396
ChangePictureTransformProcPtr ChangePictureTransform;
397
ChangePictureFilterProcPtr ChangePictureFilter;
398
DestroyPictureFilterProcPtr DestroyPictureFilter;
400
TrapezoidsProcPtr Trapezoids;
401
TrianglesProcPtr Triangles;
402
TriStripProcPtr TriStrip;
403
TriFanProcPtr TriFan;
405
RasterizeTrapezoidProcPtr RasterizeTrapezoid;
407
AddTrianglesProcPtr AddTriangles;
409
AddTrapsProcPtr AddTraps;
411
int totalGlyphPrivateSize;
412
unsigned int *glyphPrivateSizes;
414
int glyphPrivateOffset;
416
RealizeGlyphProcPtr RealizeGlyph;
417
UnrealizeGlyphProcPtr UnrealizeGlyph;
419
} PictureScreenRec, *PictureScreenPtr;
421
extern int PictureScreenPrivateIndex;
422
extern int PictureWindowPrivateIndex;
423
extern RESTYPE PictureType;
424
extern RESTYPE PictFormatType;
425
extern RESTYPE GlyphSetType;
427
#define GetPictureScreen(s) ((PictureScreenPtr) ((s)->devPrivates[PictureScreenPrivateIndex].ptr))
428
#define GetPictureScreenIfSet(s) ((PictureScreenPrivateIndex != -1) ? GetPictureScreen(s) : NULL)
429
#define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (pointer) (p))
430
#define GetPictureWindow(w) ((PicturePtr) ((w)->devPrivates[PictureWindowPrivateIndex].ptr))
431
#define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (pointer) (p))
433
#define GetGlyphPrivatesForScreen(glyph, s) \
434
((glyph)->devPrivates + (GetPictureScreen (s))->glyphPrivateOffset)
436
#define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
437
pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\
439
client->errorValue = pid; \
444
#define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
448
VERIFY_PICTURE(pPicture, pid, client, mode, err); \
453
ResetPicturePrivateIndex (void);
456
AllocatePicturePrivateIndex (void);
459
AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount);
462
PictureDestroyWindow (WindowPtr pWindow);
465
PictureCloseScreen (int Index, ScreenPtr pScreen);
468
PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
471
PictureInitIndexedFormats (ScreenPtr pScreen);
474
PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
477
PictureGetSubpixelOrder (ScreenPtr pScreen);
480
PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
483
PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual);
486
PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format);
489
PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
492
PictureGetFilterId (char *filter, int len, Bool makeit);
495
PictureGetFilterName (int id);
498
PictureAddFilter (ScreenPtr pScreen,
500
PictFilterValidateParamsProcPtr ValidateParams);
503
PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias);
506
PictureSetDefaultFilters (ScreenPtr pScreen);
509
PictureResetFilters (ScreenPtr pScreen);
512
PictureFindFilter (ScreenPtr pScreen, char *name, int len);
515
SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams);
518
PictureFinishInit (void);
521
SetPictureToDefaults (PicturePtr pPicture);
524
AllocatePicture (ScreenPtr pScreen);
528
miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
533
CreatePicture (Picture pid,
534
DrawablePtr pDrawable,
535
PictFormatPtr pFormat,
542
ChangePicture (PicturePtr pPicture,
549
SetPictureClipRects (PicturePtr pPicture,
556
SetPictureClipRegion (PicturePtr pPicture,
562
SetPictureTransform (PicturePtr pPicture,
563
PictTransform *transform);
566
CopyPicture (PicturePtr pSrc,
571
ValidatePicture(PicturePtr pPicture);
574
FreePicture (pointer pPicture,
578
FreePictFormat (pointer pPictFormat,
582
CompositePicture (CARD8 op,
596
CompositeGlyphs (CARD8 op,
599
PictFormatPtr maskFormat,
607
CompositeRects (CARD8 op,
614
CompositeTrapezoids (CARD8 op,
617
PictFormatPtr maskFormat,
624
CompositeTriangles (CARD8 op,
627
PictFormatPtr maskFormat,
631
xTriangle *triangles);
634
CompositeTriStrip (CARD8 op,
637
PictFormatPtr maskFormat,
641
xPointFixed *points);
644
CompositeTriFan (CARD8 op,
647
PictFormatPtr maskFormat,
651
xPointFixed *points);
654
PictureTransformPoint (PictTransformPtr transform,
655
PictVectorPtr vector);
658
PictureTransformPoint3d (PictTransformPtr transform,
659
PictVectorPtr vector);
662
PictureGradientColor (PictGradientStopPtr stop1,
663
PictGradientStopPtr stop2,
666
void RenderExtensionInit (void);
669
AnimCurInit (ScreenPtr pScreen);
672
AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor);
675
AddTraps (PicturePtr pPicture,
682
CreateDevicePicture (Picture pid,
686
CreateSolidPicture (Picture pid,
691
CreateLinearGradientPicture (Picture pid,
696
xRenderColor *colors,
700
CreateRadialGradientPicture (Picture pid,
707
xRenderColor *colors,
711
CreateConicalGradientPicture (Picture pid,
716
xRenderColor *colors,
720
void PanoramiXRenderInit (void);
721
void PanoramiXRenderReset (void);
724
#endif /* _PICTURESTR_H_ */