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 |
|
---|
23 | #ifdef HAVE_DIX_CONFIG_H
|
---|
24 | #include <dix-config.h>
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #include "gcstruct.h"
|
---|
28 | #include "picturestr.h"
|
---|
29 | #include "privates.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 _X_EXPORT DevPrivateKey cwGCKey;
|
---|
48 |
|
---|
49 | #define getCwGC(pGC) ((cwGCPtr)dixLookupPrivate(&(pGC)->devPrivates, cwGCKey))
|
---|
50 | #define setCwGC(pGC,p) dixSetPrivate(&(pGC)->devPrivates, cwGCKey, 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) (pPicture->pDrawable ? \
|
---|
64 | (cwPicturePtr)dixLookupPrivate(&(pPicture)->devPrivates, cwPictureKey) : 0)
|
---|
65 | #define setCwPicture(pPicture,p) dixSetPrivate(&(pPicture)->devPrivates, cwPictureKey, p)
|
---|
66 |
|
---|
67 | extern _X_EXPORT DevPrivateKey cwPictureKey;
|
---|
68 | extern _X_EXPORT DevPrivateKey cwWindowKey;
|
---|
69 |
|
---|
70 | #define cwWindowPrivate(pWin) dixLookupPrivate(&(pWin)->devPrivates, cwWindowKey)
|
---|
71 | #define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
|
---|
72 | #define setCwPixmap(pWindow,pPixmap) \
|
---|
73 | dixSetPrivate(&(pWindow)->devPrivates, cwWindowKey, 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 | CopyWindowProcPtr CopyWindow;
|
---|
89 |
|
---|
90 | GetWindowPixmapProcPtr GetWindowPixmap;
|
---|
91 | SetWindowPixmapProcPtr SetWindowPixmap;
|
---|
92 |
|
---|
93 | #ifdef RENDER
|
---|
94 | DestroyPictureProcPtr DestroyPicture;
|
---|
95 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
96 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
97 |
|
---|
98 | ChangePictureProcPtr ChangePicture;
|
---|
99 | ValidatePictureProcPtr ValidatePicture;
|
---|
100 |
|
---|
101 | CompositeProcPtr Composite;
|
---|
102 | CompositeRectsProcPtr CompositeRects;
|
---|
103 |
|
---|
104 | TrapezoidsProcPtr Trapezoids;
|
---|
105 | TrianglesProcPtr Triangles;
|
---|
106 | TriStripProcPtr TriStrip;
|
---|
107 | TriFanProcPtr TriFan;
|
---|
108 |
|
---|
109 | RasterizeTrapezoidProcPtr RasterizeTrapezoid;
|
---|
110 | #endif
|
---|
111 | } cwScreenRec, *cwScreenPtr;
|
---|
112 |
|
---|
113 | extern _X_EXPORT DevPrivateKey cwScreenKey;
|
---|
114 |
|
---|
115 | #define getCwScreen(pScreen) ((cwScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, cwScreenKey))
|
---|
116 | #define setCwScreen(pScreen,p) dixSetPrivate(&(pScreen)->devPrivates, cwScreenKey, p)
|
---|
117 |
|
---|
118 | #define CW_OFFSET_XYPOINTS(ppt, npt) do { \
|
---|
119 | DDXPointPtr _ppt = (DDXPointPtr)(ppt); \
|
---|
120 | int _i; \
|
---|
121 | for (_i = 0; _i < npt; _i++) { \
|
---|
122 | _ppt[_i].x += dst_off_x; \
|
---|
123 | _ppt[_i].y += dst_off_y; \
|
---|
124 | } \
|
---|
125 | } while (0)
|
---|
126 |
|
---|
127 | #define CW_OFFSET_RECTS(prect, nrect) do { \
|
---|
128 | int _i; \
|
---|
129 | for (_i = 0; _i < nrect; _i++) { \
|
---|
130 | (prect)[_i].x += dst_off_x; \
|
---|
131 | (prect)[_i].y += dst_off_y; \
|
---|
132 | } \
|
---|
133 | } while (0)
|
---|
134 |
|
---|
135 | #define CW_OFFSET_ARCS(parc, narc) do { \
|
---|
136 | int _i; \
|
---|
137 | for (_i = 0; _i < narc; _i++) { \
|
---|
138 | (parc)[_i].x += dst_off_x; \
|
---|
139 | (parc)[_i].y += dst_off_y; \
|
---|
140 | } \
|
---|
141 | } while (0)
|
---|
142 |
|
---|
143 | #define CW_OFFSET_XY_DST(x, y) do { \
|
---|
144 | (x) = (x) + dst_off_x; \
|
---|
145 | (y) = (y) + dst_off_y; \
|
---|
146 | } while (0)
|
---|
147 |
|
---|
148 | #define CW_OFFSET_XY_SRC(x, y) do { \
|
---|
149 | (x) = (x) + src_off_x; \
|
---|
150 | (y) = (y) + src_off_y; \
|
---|
151 | } while (0)
|
---|
152 |
|
---|
153 | /* cw.c */
|
---|
154 | extern _X_EXPORT DrawablePtr
|
---|
155 | cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off);
|
---|
156 |
|
---|
157 | /* cw_render.c */
|
---|
158 |
|
---|
159 | extern _X_EXPORT void
|
---|
160 | cwInitializeRender (ScreenPtr pScreen);
|
---|
161 |
|
---|
162 | extern _X_EXPORT void
|
---|
163 | cwFiniRender (ScreenPtr pScreen);
|
---|
164 |
|
---|
165 | /* cw.c */
|
---|
166 |
|
---|
167 | extern _X_EXPORT void
|
---|
168 | miInitializeCompositeWrapper(ScreenPtr pScreen);
|
---|