First import
[xorg_rtime.git] / xorg-server-1.4 / miext / cw / cw.h
blob0d57b9b9dc70acdb304a0af50d8e1d703915f3de
1 /*
2 * Copyright © 2004 Eric Anholt
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.
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.
23 #ifdef HAVE_DIX_CONFIG_H
24 #include <dix-config.h>
25 #endif
27 #include "gcstruct.h"
28 #include "picturestr.h"
31 * One of these structures is allocated per GC that gets used with a window with
32 * backing pixmap.
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;
46 extern int cwGCIndex;
48 #define getCwGC(pGC) ((cwGCPtr)(pGC)->devPrivates[cwGCIndex].ptr)
49 #define setCwGC(pGC,p) ((pGC)->devPrivates[cwGCIndex].ptr = (pointer) (p))
52 * One of these structures is allocated per Picture that gets used with a
53 * window with a backing pixmap
56 typedef struct {
57 PicturePtr pBackingPicture;
58 unsigned long serialNumber;
59 unsigned long stateChanges;
60 } cwPictureRec, *cwPicturePtr;
62 #define getCwPicture(pPicture) \
63 (pPicture->pDrawable ? (cwPicturePtr)(pPicture)->devPrivates[cwPictureIndex].ptr : 0)
64 #define setCwPicture(pPicture,p) ((pPicture)->devPrivates[cwPictureIndex].ptr = (pointer) (p))
66 extern int cwPictureIndex;
68 extern int cwWindowIndex;
70 #define cwWindowPrivate(pWindow) ((pWindow)->devPrivates[cwWindowIndex].ptr)
71 #define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
72 #define setCwPixmap(pWindow,pPixmap) (cwWindowPrivate(pWindow) = (pointer) (pPixmap))
74 #define cwDrawableIsRedirWindow(pDraw) \
75 ((pDraw)->type == DRAWABLE_WINDOW && \
76 getCwPixmap((WindowPtr) (pDraw)) != NULL)
78 typedef struct {
80 * screen func wrappers
82 CloseScreenProcPtr CloseScreen;
83 GetImageProcPtr GetImage;
84 GetSpansProcPtr GetSpans;
85 CreateGCProcPtr CreateGC;
87 PaintWindowBackgroundProcPtr PaintWindowBackground;
88 PaintWindowBorderProcPtr PaintWindowBorder;
89 CopyWindowProcPtr CopyWindow;
91 GetWindowPixmapProcPtr GetWindowPixmap;
92 SetWindowPixmapProcPtr SetWindowPixmap;
94 #ifdef RENDER
95 DestroyPictureProcPtr DestroyPicture;
96 ChangePictureClipProcPtr ChangePictureClip;
97 DestroyPictureClipProcPtr DestroyPictureClip;
99 ChangePictureProcPtr ChangePicture;
100 ValidatePictureProcPtr ValidatePicture;
102 CompositeProcPtr Composite;
103 GlyphsProcPtr Glyphs;
104 CompositeRectsProcPtr CompositeRects;
106 TrapezoidsProcPtr Trapezoids;
107 TrianglesProcPtr Triangles;
108 TriStripProcPtr TriStrip;
109 TriFanProcPtr TriFan;
111 RasterizeTrapezoidProcPtr RasterizeTrapezoid;
112 #endif
113 } cwScreenRec, *cwScreenPtr;
115 extern int cwScreenIndex;
117 #define getCwScreen(pScreen) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr)
118 #define setCwScreen(pScreen,p) ((cwScreenPtr)(pScreen)->devPrivates[cwScreenIndex].ptr = (p))
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; \
127 } while (0)
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; \
135 } while (0)
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; \
143 } while (0)
145 #define CW_OFFSET_XY_DST(x, y) do { \
146 (x) = (x) + dst_off_x; \
147 (y) = (y) + dst_off_y; \
148 } while (0)
150 #define CW_OFFSET_XY_SRC(x, y) do { \
151 (x) = (x) + src_off_x; \
152 (y) = (y) + src_off_y; \
153 } while (0)
155 /* cw.c */
156 DrawablePtr
157 cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off);
159 /* cw_render.c */
161 void
162 cwInitializeRender (ScreenPtr pScreen);
164 void
165 cwFiniRender (ScreenPtr pScreen);
167 /* cw.c */
169 void
170 miInitializeCompositeWrapper(ScreenPtr pScreen);