1 | /*
|
---|
2 | * Copyright © 2004 Eric Anholt
|
---|
3 | *
|
---|
4 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
5 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
6 | * the above copyright notice appear in all copies and that both that
|
---|
7 | * copyright notice and this permission notice appear in supporting
|
---|
8 | * documentation, and that the name of Eric Anholt not be used in
|
---|
9 | * advertising or publicity pertaining to distribution of the software without
|
---|
10 | * specific, written prior permission. Eric Anholt makes no
|
---|
11 | * representations about the suitability of this software for any purpose. It
|
---|
12 | * is provided "as is" without express or implied warranty.
|
---|
13 | *
|
---|
14 | * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
16 | * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
---|
20 | * PERFORMANCE OF THIS SOFTWARE.
|
---|
21 | */
|
---|
22 | /* $Header: /cvs/xorg/xc/programs/Xserver/miext/cw/cw.h,v 1.13 2005/10/02 08:28:26 anholt Exp $ */
|
---|
23 |
|
---|
24 | #ifdef HAVE_DIX_CONFIG_H
|
---|
25 | #include <dix-config.h>
|
---|
26 | #endif
|
---|
27 |
|
---|
28 | #include "gcstruct.h"
|
---|
29 | #include "picturestr.h"
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * One of these structures is allocated per GC that gets used with a window with
|
---|
33 | * backing pixmap.
|
---|
34 | */
|
---|
35 |
|
---|
36 | typedef struct {
|
---|
37 | GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures
|
---|
38 | * set FALSE and the clientClip set to
|
---|
39 | * clip output to the valid regions of the
|
---|
40 | * backing pixmap. */
|
---|
41 | unsigned long serialNumber; /* clientClip computed time */
|
---|
42 | unsigned long stateChanges; /* changes in parent gc since last copy */
|
---|
43 | GCOps *wrapOps; /* wrapped ops */
|
---|
44 | GCFuncs *wrapFuncs; /* wrapped funcs */
|
---|
45 | } cwGCRec, *cwGCPtr;
|
---|
46 |
|
---|
47 | extern int cwGCIndex;
|
---|
48 |
|
---|
49 | #define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr)
|
---|
50 | #define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (pointer) (p))
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * One of these structures is allocated per Picture that gets used with a
|
---|
54 | * window with a backing pixmap
|
---|
55 | */
|
---|
56 |
|
---|
57 | typedef struct {
|
---|
58 | PicturePtr pBackingPicture;
|
---|
59 | unsigned long serialNumber;
|
---|
60 | unsigned long stateChanges;
|
---|
61 | } cwPictureRec, *cwPicturePtr;
|
---|
62 |
|
---|
63 | #define getCwPicture(pPicture) \
|
---|
64 | (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0)
|
---|
65 | #define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p))
|
---|
66 |
|
---|
67 | extern int cwPictureIndex;
|
---|
68 |
|
---|
69 | extern int cwWindowIndex;
|
---|
70 |
|
---|
71 | #define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr)
|
---|
72 | #define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
|
---|
73 | #define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap))
|
---|
74 |
|
---|
75 | #define cwDrawableIsRedirWindow(pDraw) \
|
---|
76 | ((pDraw)->type == DRAWABLE_WINDOW && \
|
---|
77 | getCwPixmap((WindowPtr) (pDraw)) != NULL)
|
---|
78 |
|
---|
79 | typedef struct {
|
---|
80 | /*
|
---|
81 | * screen func wrappers
|
---|
82 | */
|
---|
83 | CloseScreenProcPtr CloseScreen;
|
---|
84 | GetImageProcPtr GetImage;
|
---|
85 | GetSpansProcPtr GetSpans;
|
---|
86 | CreateGCProcPtr CreateGC;
|
---|
87 |
|
---|
88 | PaintWindowBackgroundProcPtr PaintWindowBackground;
|
---|
89 | PaintWindowBorderProcPtr PaintWindowBorder;
|
---|
90 | CopyWindowProcPtr CopyWindow;
|
---|
91 |
|
---|
92 | GetWindowPixmapProcPtr GetWindowPixmap;
|
---|
93 | SetWindowPixmapProcPtr SetWindowPixmap;
|
---|
94 |
|
---|
95 | #ifdef RENDER
|
---|
96 | DestroyPictureProcPtr DestroyPicture;
|
---|
97 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
98 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
99 |
|
---|
100 | ChangePictureProcPtr ChangePicture;
|
---|
101 | ValidatePictureProcPtr ValidatePicture;
|
---|
102 |
|
---|
103 | CompositeProcPtr Composite;
|
---|
104 | GlyphsProcPtr Glyphs;
|
---|
105 | CompositeRectsProcPtr CompositeRects;
|
---|
106 |
|
---|
107 | TrapezoidsProcPtr Trapezoids;
|
---|
108 | TrianglesProcPtr Triangles;
|
---|
109 | TriStripProcPtr TriStrip;
|
---|
110 | TriFanProcPtr TriFan;
|
---|
111 |
|
---|
112 | RasterizeTrapezoidProcPtr RasterizeTrapezoid;
|
---|
113 | #endif
|
---|
114 | } cwScreenRec, *cwScreenPtr;
|
---|
115 |
|
---|
116 | extern int cwScreenIndex;
|
---|
117 |
|
---|
118 | #define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr)
|
---|
119 | #define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p))
|
---|
120 |
|
---|
121 | #define CW_OFFSET_XYPOINTS(ppt, npt) do { \
|
---|
122 | DDXPointPtr _ppt = (DDXPointPtr)(ppt); \
|
---|
123 | int _i; \
|
---|
124 | for (_i = 0; _i < npt; _i++) { \
|
---|
125 | _ppt[_i].x += dst_off_x; \
|
---|
126 | _ppt[_i].y += dst_off_y; \
|
---|
127 | } \
|
---|
128 | } while (0)
|
---|
129 |
|
---|
130 | #define CW_OFFSET_RECTS(prect, nrect) do { \
|
---|
131 | int _i; \
|
---|
132 | for (_i = 0; _i < nrect; _i++) { \
|
---|
133 | (prect)[_i].x += dst_off_x; \
|
---|
134 | (prect)[_i].y += dst_off_y; \
|
---|
135 | } \
|
---|
136 | } while (0)
|
---|
137 |
|
---|
138 | #define CW_OFFSET_ARCS(parc, narc) do { \
|
---|
139 | int _i; \
|
---|
140 | for (_i = 0; _i < narc; _i++) { \
|
---|
141 | (parc)[_i].x += dst_off_x; \
|
---|
142 | (parc)[_i].y += dst_off_y; \
|
---|
143 | } \
|
---|
144 | } while (0)
|
---|
145 |
|
---|
146 | #define CW_OFFSET_XY_DST(x, y) do { \
|
---|
147 | (x) = (x) + dst_off_x; \
|
---|
148 | (y) = (y) + dst_off_y; \
|
---|
149 | } while (0)
|
---|
150 |
|
---|
151 | #define CW_OFFSET_XY_SRC(x, y) do { \
|
---|
152 | (x) = (x) + src_off_x; \
|
---|
153 | (y) = (y) + src_off_y; \
|
---|
154 | } while (0)
|
---|
155 |
|
---|
156 | /* cw.c */
|
---|
157 | DrawablePtr
|
---|
158 | cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off);
|
---|
159 |
|
---|
160 | /* cw_render.c */
|
---|
161 |
|
---|
162 | void
|
---|
163 | cwInitializeRender (ScreenPtr pScreen);
|
---|
164 |
|
---|
165 | void
|
---|
166 | cwFiniRender (ScreenPtr pScreen);
|
---|
167 |
|
---|
168 | /* cw.c */
|
---|
169 |
|
---|
170 | void
|
---|
171 | miInitializeCompositeWrapper(ScreenPtr pScreen);
|
---|
172 |
|
---|
173 | /* Must be called before miInitializeCompositeWrapper */
|
---|
174 | void
|
---|
175 | miDisableCompositeWrapper(ScreenPtr pScreen);
|
---|