1706f2543Smrg/* 2706f2543Smrg * Copyright © 2004 Eric Anholt 3706f2543Smrg * 4706f2543Smrg * Permission to use, copy, modify, distribute, and sell this software and its 5706f2543Smrg * documentation for any purpose is hereby granted without fee, provided that 6706f2543Smrg * the above copyright notice appear in all copies and that both that 7706f2543Smrg * copyright notice and this permission notice appear in supporting 8706f2543Smrg * documentation, and that the name of Eric Anholt not be used in 9706f2543Smrg * advertising or publicity pertaining to distribution of the software without 10706f2543Smrg * specific, written prior permission. Eric Anholt makes no 11706f2543Smrg * representations about the suitability of this software for any purpose. It 12706f2543Smrg * is provided "as is" without express or implied warranty. 13706f2543Smrg * 14706f2543Smrg * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 15706f2543Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 16706f2543Smrg * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR 17706f2543Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 18706f2543Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19706f2543Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 20706f2543Smrg * PERFORMANCE OF THIS SOFTWARE. 21706f2543Smrg */ 22706f2543Smrg 23706f2543Smrg#ifdef HAVE_DIX_CONFIG_H 24706f2543Smrg#include <dix-config.h> 25706f2543Smrg#endif 26706f2543Smrg 27706f2543Smrg#include "gcstruct.h" 28706f2543Smrg#include "picturestr.h" 29706f2543Smrg#include "privates.h" 30706f2543Smrg 31706f2543Smrg/* 32706f2543Smrg * One of these structures is allocated per GC that gets used with a window with 33706f2543Smrg * backing pixmap. 34706f2543Smrg */ 35706f2543Smrg 36706f2543Smrgtypedef struct { 37706f2543Smrg GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures 38706f2543Smrg * set FALSE and the clientClip set to 39706f2543Smrg * clip output to the valid regions of the 40706f2543Smrg * backing pixmap. */ 41706f2543Smrg unsigned long serialNumber; /* clientClip computed time */ 42706f2543Smrg unsigned long stateChanges; /* changes in parent gc since last copy */ 43706f2543Smrg GCOps *wrapOps; /* wrapped ops */ 44706f2543Smrg GCFuncs *wrapFuncs; /* wrapped funcs */ 45706f2543Smrg} cwGCRec, *cwGCPtr; 46706f2543Smrg 47706f2543Smrgextern _X_EXPORT DevPrivateKeyRec cwGCKeyRec; 48706f2543Smrg#define cwGCKey (&cwGCKeyRec) 49706f2543Smrg 50706f2543Smrg#define getCwGC(pGC) ((cwGCPtr)dixLookupPrivate(&(pGC)->devPrivates, cwGCKey)) 51706f2543Smrg#define setCwGC(pGC,p) dixSetPrivate(&(pGC)->devPrivates, cwGCKey, p) 52706f2543Smrg 53706f2543Smrg/* 54706f2543Smrg * One of these structures is allocated per Picture that gets used with a 55706f2543Smrg * window with a backing pixmap 56706f2543Smrg */ 57706f2543Smrg 58706f2543Smrgtypedef struct { 59706f2543Smrg PicturePtr pBackingPicture; 60706f2543Smrg unsigned long serialNumber; 61706f2543Smrg unsigned long stateChanges; 62706f2543Smrg} cwPictureRec, *cwPicturePtr; 63706f2543Smrg 64706f2543Smrgextern _X_EXPORT DevPrivateKeyRec cwPictureKeyRec; 65706f2543Smrg#define cwPictureKey (&cwPictureKeyRec) 66706f2543Smrg 67706f2543Smrg#define getCwPicture(pPicture) (pPicture->pDrawable ? \ 68706f2543Smrg (cwPicturePtr)dixLookupPrivate(&(pPicture)->devPrivates, cwPictureKey) : 0) 69706f2543Smrg#define setCwPicture(pPicture,p) dixSetPrivate(&(pPicture)->devPrivates, cwPictureKey, p) 70706f2543Smrg 71706f2543Smrgextern _X_EXPORT DevPrivateKeyRec cwWindowKeyRec; 72706f2543Smrg#define cwWindowKey (&cwWindowKeyRec) 73706f2543Smrg 74706f2543Smrg#define cwWindowPrivate(pWin) dixLookupPrivate(&(pWin)->devPrivates, cwWindowKey) 75706f2543Smrg#define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow)) 76706f2543Smrg#define setCwPixmap(pWindow,pPixmap) \ 77706f2543Smrg dixSetPrivate(&(pWindow)->devPrivates, cwWindowKey, pPixmap) 78706f2543Smrg 79706f2543Smrg#define cwDrawableIsRedirWindow(pDraw) \ 80706f2543Smrg ((pDraw)->type == DRAWABLE_WINDOW && \ 81706f2543Smrg getCwPixmap((WindowPtr) (pDraw)) != NULL) 82706f2543Smrg 83706f2543Smrgtypedef struct { 84706f2543Smrg /* 85706f2543Smrg * screen func wrappers 86706f2543Smrg */ 87706f2543Smrg CloseScreenProcPtr CloseScreen; 88706f2543Smrg GetImageProcPtr GetImage; 89706f2543Smrg GetSpansProcPtr GetSpans; 90706f2543Smrg CreateGCProcPtr CreateGC; 91706f2543Smrg 92706f2543Smrg CopyWindowProcPtr CopyWindow; 93706f2543Smrg 94706f2543Smrg GetWindowPixmapProcPtr GetWindowPixmap; 95706f2543Smrg SetWindowPixmapProcPtr SetWindowPixmap; 96706f2543Smrg 97706f2543Smrg DestroyPictureProcPtr DestroyPicture; 98706f2543Smrg ChangePictureClipProcPtr ChangePictureClip; 99706f2543Smrg DestroyPictureClipProcPtr DestroyPictureClip; 100706f2543Smrg 101706f2543Smrg ChangePictureProcPtr ChangePicture; 102706f2543Smrg ValidatePictureProcPtr ValidatePicture; 103706f2543Smrg 104706f2543Smrg CompositeProcPtr Composite; 105706f2543Smrg CompositeRectsProcPtr CompositeRects; 106706f2543Smrg 107706f2543Smrg TrapezoidsProcPtr Trapezoids; 108706f2543Smrg TrianglesProcPtr Triangles; 109706f2543Smrg TriStripProcPtr TriStrip; 110706f2543Smrg TriFanProcPtr TriFan; 111706f2543Smrg 112706f2543Smrg RasterizeTrapezoidProcPtr RasterizeTrapezoid; 113706f2543Smrg} cwScreenRec, *cwScreenPtr; 114706f2543Smrg 115706f2543Smrgextern _X_EXPORT DevPrivateKeyRec cwScreenKeyRec; 116706f2543Smrg#define cwScreenKey (&cwScreenKeyRec) 117706f2543Smrg 118706f2543Smrg#define getCwScreen(pScreen) ((cwScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, cwScreenKey)) 119706f2543Smrg#define setCwScreen(pScreen,p) dixSetPrivate(&(pScreen)->devPrivates, cwScreenKey, p) 120706f2543Smrg 121706f2543Smrg#define CW_OFFSET_XYPOINTS(ppt, npt) do { \ 122706f2543Smrg DDXPointPtr _ppt = (DDXPointPtr)(ppt); \ 123706f2543Smrg int _i; \ 124706f2543Smrg for (_i = 0; _i < npt; _i++) { \ 125706f2543Smrg _ppt[_i].x += dst_off_x; \ 126706f2543Smrg _ppt[_i].y += dst_off_y; \ 127706f2543Smrg } \ 128706f2543Smrg} while (0) 129706f2543Smrg 130706f2543Smrg#define CW_OFFSET_RECTS(prect, nrect) do { \ 131706f2543Smrg int _i; \ 132706f2543Smrg for (_i = 0; _i < nrect; _i++) { \ 133706f2543Smrg (prect)[_i].x += dst_off_x; \ 134706f2543Smrg (prect)[_i].y += dst_off_y; \ 135706f2543Smrg } \ 136706f2543Smrg} while (0) 137706f2543Smrg 138706f2543Smrg#define CW_OFFSET_ARCS(parc, narc) do { \ 139706f2543Smrg int _i; \ 140706f2543Smrg for (_i = 0; _i < narc; _i++) { \ 141706f2543Smrg (parc)[_i].x += dst_off_x; \ 142706f2543Smrg (parc)[_i].y += dst_off_y; \ 143706f2543Smrg } \ 144706f2543Smrg} while (0) 145706f2543Smrg 146706f2543Smrg#define CW_OFFSET_XY_DST(x, y) do { \ 147706f2543Smrg (x) = (x) + dst_off_x; \ 148706f2543Smrg (y) = (y) + dst_off_y; \ 149706f2543Smrg} while (0) 150706f2543Smrg 151706f2543Smrg#define CW_OFFSET_XY_SRC(x, y) do { \ 152706f2543Smrg (x) = (x) + src_off_x; \ 153706f2543Smrg (y) = (y) + src_off_y; \ 154706f2543Smrg} while (0) 155706f2543Smrg 156706f2543Smrg/* cw.c */ 157706f2543Smrgextern _X_EXPORT DrawablePtr 158706f2543SmrgcwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off); 159706f2543Smrg 160706f2543Smrg/* cw_render.c */ 161706f2543Smrg 162706f2543Smrgextern _X_EXPORT void 163706f2543SmrgcwInitializeRender (ScreenPtr pScreen); 164706f2543Smrg 165706f2543Smrgextern _X_EXPORT void 166706f2543SmrgcwFiniRender (ScreenPtr pScreen); 167706f2543Smrg 168706f2543Smrg/* cw.c */ 169706f2543Smrg 170706f2543Smrgextern _X_EXPORT void 171706f2543SmrgmiInitializeCompositeWrapper(ScreenPtr pScreen); 172