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 |
|
---|
30 | /*
|
---|
31 | * One of these structures is allocated per GC that gets used with a window with
|
---|
32 | * backing pixmap.
|
---|
33 | */
|
---|
34 |
|
---|
35 | typedef struct {
|
---|
36 | GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures
|
---|
37 | * set FALSE and the clientClip set to
|
---|
38 | * clip output to the valid regions of the
|
---|
39 | * backing pixmap. */
|
---|
40 | unsigned long serialNumber; /* clientClip computed time */
|
---|
41 | unsigned long stateChanges; /* changes in parent gc since last copy */
|
---|
42 | GCOps *wrapOps; /* wrapped ops */
|
---|
43 | GCFuncs *wrapFuncs; /* wrapped funcs */
|
---|
44 | } cwGCRec, *cwGCPtr;
|
---|
45 |
|
---|
46 | extern int cwGCIndex;
|
---|
47 |
|
---|
48 | #define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr)
|
---|
49 | #define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (pointer) (p))
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * One of these structures is allocated per Picture that gets used with a
|
---|
53 | * window with a backing pixmap
|
---|
54 | */
|
---|
55 |
|
---|
56 | typedef struct {
|
---|
57 | PicturePtr pBackingPicture;
|
---|
58 | unsigned long serialNumber;
|
---|
59 | unsigned long stateChanges;
|
---|
60 | } cwPictureRec, *cwPicturePtr;
|
---|
61 |
|
---|
62 | #define getCwPicture(pPicture) \
|
---|
63 | (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0)
|
---|
64 | #define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p))
|
---|
65 |
|
---|
66 | extern int cwPictureIndex;
|
---|
67 |
|
---|
68 | extern int cwWindowIndex;
|
---|
69 |
|
---|
70 | #define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr)
|
---|
71 | #define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
|
---|
72 | #define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap))
|
---|
73 |
|
---|
74 | #define cwDrawableIsRedirWindow(pDraw) \
|
---|
75 | ((pDraw)->type == DRAWABLE_WINDOW && \
|
---|
76 | getCwPixmap((WindowPtr) (pDraw)) != NULL)
|
---|
77 |
|
---|
78 | typedef struct {
|
---|
79 | /*
|
---|
80 | * screen func wrappers
|
---|
81 | */
|
---|
82 | CloseScreenProcPtr CloseScreen;
|
---|
83 | GetImageProcPtr GetImage;
|
---|
84 | GetSpansProcPtr GetSpans;
|
---|
85 | CreateGCProcPtr CreateGC;
|
---|
86 |
|
---|
87 | PaintWindowBackgroundProcPtr PaintWindowBackground;
|
---|
88 | PaintWindowBorderProcPtr PaintWindowBorder;
|
---|
89 | CopyWindowProcPtr CopyWindow;
|
---|
90 |
|
---|
91 | GetWindowPixmapProcPtr GetWindowPixmap;
|
---|
92 | SetWindowPixmapProcPtr SetWindowPixmap;
|
---|
93 |
|
---|
94 | #ifdef RENDER
|
---|
95 | DestroyPictureProcPtr DestroyPicture;
|
---|
96 | ChangePictureClipProcPtr ChangePictureClip;
|
---|
97 | DestroyPictureClipProcPtr DestroyPictureClip;
|
---|
98 |
|
---|
99 | ChangePictureProcPtr ChangePicture;
|
---|
100 | ValidatePictureProcPtr ValidatePicture;
|
---|
101 |
|
---|
102 | CompositeProcPtr Composite;
|
---|
103 | GlyphsProcPtr Glyphs;
|
---|
104 | CompositeRectsProcPtr CompositeRects;
|
---|
105 |
|
---|
106 | TrapezoidsProcPtr Trapezoids;
|
---|
107 | TrianglesProcPtr Triangles;
|
---|
108 | TriStripProcPtr TriStrip;
|
---|
109 | TriFanProcPtr TriFan;
|
---|
110 |
|
---|
111 | RasterizeTrapezoidProcPtr RasterizeTrapezoid;
|
---|
112 | #endif
|
---|
113 | } cwScreenRec, *cwScreenPtr;
|
---|
114 |
|
---|
115 | extern int cwScreenIndex;
|
---|
116 |
|
---|
117 | #define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr)
|
---|
118 | #define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p))
|
---|
119 |
|
---|
120 | #define CW_OFFSET_XYPOINTS(ppt, npt) do { \
|
---|
121 | DDXPointPtr _ppt = (DDXPointPtr)(ppt); \
|
---|
122 | int _i; \
|
---|
123 | for (_i = 0; _i < npt; _i++) { \
|
---|
124 | _ppt[_i].x += dst_off_x; \
|
---|
125 | _ppt[_i].y += dst_off_y; \
|
---|
126 | } \
|
---|
127 | } while (0)
|
---|
128 |
|
---|
129 | #define CW_OFFSET_RECTS(prect, nrect) do { \
|
---|
130 | int _i; \
|
---|
131 | for (_i = 0; _i < nrect; _i++) { \
|
---|
132 | (prect)[_i].x += dst_off_x; \
|
---|
133 | (prect)[_i].y += dst_off_y; \
|
---|
134 | } \
|
---|
135 | } while (0)
|
---|
136 |
|
---|
137 | #define CW_OFFSET_ARCS(parc, narc) do { \
|
---|
138 | int _i; \
|
---|
139 | for (_i = 0; _i < narc; _i++) { \
|
---|
140 | (parc)[_i].x += dst_off_x; \
|
---|
141 | (parc)[_i].y += dst_off_y; \
|
---|
142 | } \
|
---|
143 | } while (0)
|
---|
144 |
|
---|
145 | #define CW_OFFSET_XY_DST(x, y) do { \
|
---|
146 | (x) = (x) + dst_off_x; \
|
---|
147 | (y) = (y) + dst_off_y; \
|
---|
148 | } while (0)
|
---|
149 |
|
---|
150 | #define CW_OFFSET_XY_SRC(x, y) do { \
|
---|
151 | (x) = (x) + src_off_x; \
|
---|
152 | (y) = (y) + src_off_y; \
|
---|
153 | } while (0)
|
---|
154 |
|
---|
155 | /* cw.c */
|
---|
156 | DrawablePtr
|
---|
157 | cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off);
|
---|
158 |
|
---|
159 | /* cw_render.c */
|
---|
160 |
|
---|
161 | void
|
---|
162 | cwInitializeRender (ScreenPtr pScreen);
|
---|
163 |
|
---|
164 | void
|
---|
165 | cwFiniRender (ScreenPtr pScreen);
|
---|
166 |
|
---|
167 | /* cw.c */
|
---|
168 |
|
---|
169 | void
|
---|
170 | miInitializeCompositeWrapper(ScreenPtr pScreen);
|
---|