diff options
Diffstat (limited to 'xorg-server/miext/cw')
-rw-r--r-- | xorg-server/miext/cw/cw.c | 40 | ||||
-rw-r--r-- | xorg-server/miext/cw/cw.h | 337 |
2 files changed, 194 insertions, 183 deletions
diff --git a/xorg-server/miext/cw/cw.c b/xorg-server/miext/cw/cw.c index 72a90c699..e4b264771 100644 --- a/xorg-server/miext/cw/cw.c +++ b/xorg-server/miext/cw/cw.c @@ -43,14 +43,11 @@ #define CW_ASSERT(x) do {} while (0)
#endif
-static int cwGCKeyIndex;
-DevPrivateKey cwGCKey = &cwGCKeyIndex;
-static int cwScreenKeyIndex;
-DevPrivateKey cwScreenKey = &cwScreenKeyIndex;
-static int cwWindowKeyIndex;
-DevPrivateKey cwWindowKey = &cwWindowKeyIndex;
-static int cwPictureKeyIndex;
-DevPrivateKey cwPictureKey = &cwPictureKeyIndex;
+DevPrivateKeyRec cwGCKeyRec;
+DevPrivateKeyRec cwScreenKeyRec;
+DevPrivateKeyRec cwWindowKeyRec;
+DevPrivateKeyRec cwPictureKeyRec;
+
extern GCOps cwGCOps;
static Bool
@@ -191,8 +188,8 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) ChangeGCVal vals[2];
RegionPtr pCompositeClip;
- pCompositeClip = REGION_CREATE (pScreen, NULL, 0);
- REGION_COPY (pScreen, pCompositeClip, pGC->pCompositeClip);
+ pCompositeClip = RegionCreate(NULL, 0);
+ RegionCopy(pCompositeClip, pGC->pCompositeClip);
/* Either the drawable has changed, or the clip list in the drawable has
* changed. Copy the new clip list over and set the new translated
@@ -328,7 +325,7 @@ cwCreateGC(GCPtr pGC) ScreenPtr pScreen = pGC->pScreen;
Bool ret;
- bzero(pPriv, sizeof(cwGCRec));
+ memset(pPriv, 0, sizeof(cwGCRec));
SCREEN_PROLOGUE(pScreen, CreateGC);
if ( (ret = (*pScreen->CreateGC)(pGC)) )
@@ -403,7 +400,7 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
- pExtents = REGION_EXTENTS(pScreen, prgnSrc);
+ pExtents = RegionExtents(prgnSrc);
pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin,
&x_off, &y_off);
@@ -416,15 +413,15 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) dst_y = src_y - dy;
/* Translate region (as required by API) */
- REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ RegionTranslate(prgnSrc, -dx, -dy);
pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen);
/*
* Copy region to GC as clip, aligning as dest clip
*/
- pClip = REGION_CREATE (pScreen, NULL, 0);
- REGION_INTERSECT(pScreen, pClip, &pWin->borderClip, prgnSrc);
- REGION_TRANSLATE(pScreen, pClip,
+ pClip = RegionCreate(NULL, 0);
+ RegionIntersect(pClip, &pWin->borderClip, prgnSrc);
+ RegionTranslate(pClip,
-pBackingPixmap->screen_x,
-pBackingPixmap->screen_y);
@@ -477,7 +474,16 @@ miInitializeCompositeWrapper(ScreenPtr pScreen) cwScreenPtr pScreenPriv;
Bool has_render = GetPictureScreenIfSet(pScreen) != NULL;
- if (!dixRequestPrivate(cwGCKey, sizeof(cwGCRec)))
+ if (!dixRegisterPrivateKey(&cwScreenKeyRec, PRIVATE_SCREEN, 0))
+ return;
+
+ if (!dixRegisterPrivateKey(&cwGCKeyRec, PRIVATE_GC, sizeof(cwGCRec)))
+ return;
+
+ if (!dixRegisterPrivateKey(&cwWindowKeyRec, PRIVATE_WINDOW, 0))
+ return;
+
+ if (!dixRegisterPrivateKey(&cwPictureKeyRec, PRIVATE_PICTURE, 0))
return;
pScreenPriv = malloc(sizeof(cwScreenRec));
diff --git a/xorg-server/miext/cw/cw.h b/xorg-server/miext/cw/cw.h index 79051dfa2..555111c67 100644 --- a/xorg-server/miext/cw/cw.h +++ b/xorg-server/miext/cw/cw.h @@ -1,166 +1,171 @@ -/* - * Copyright © 2004 Eric Anholt - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Eric Anholt not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Eric Anholt makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include "gcstruct.h" -#include "picturestr.h" -#include "privates.h" - -/* - * One of these structures is allocated per GC that gets used with a window with - * backing pixmap. - */ - -typedef struct { - GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures - * set FALSE and the clientClip set to - * clip output to the valid regions of the - * backing pixmap. */ - unsigned long serialNumber; /* clientClip computed time */ - unsigned long stateChanges; /* changes in parent gc since last copy */ - GCOps *wrapOps; /* wrapped ops */ - GCFuncs *wrapFuncs; /* wrapped funcs */ -} cwGCRec, *cwGCPtr; - -extern _X_EXPORT DevPrivateKey cwGCKey; - -#define getCwGC(pGC) ((cwGCPtr)dixLookupPrivate(&(pGC)->devPrivates, cwGCKey)) -#define setCwGC(pGC,p) dixSetPrivate(&(pGC)->devPrivates, cwGCKey, p) - -/* - * One of these structures is allocated per Picture that gets used with a - * window with a backing pixmap - */ - -typedef struct { - PicturePtr pBackingPicture; - unsigned long serialNumber; - unsigned long stateChanges; -} cwPictureRec, *cwPicturePtr; - -#define getCwPicture(pPicture) (pPicture->pDrawable ? \ - (cwPicturePtr)dixLookupPrivate(&(pPicture)->devPrivates, cwPictureKey) : 0) -#define setCwPicture(pPicture,p) dixSetPrivate(&(pPicture)->devPrivates, cwPictureKey, p) - -extern _X_EXPORT DevPrivateKey cwPictureKey; -extern _X_EXPORT DevPrivateKey cwWindowKey; - -#define cwWindowPrivate(pWin) dixLookupPrivate(&(pWin)->devPrivates, cwWindowKey) -#define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow)) -#define setCwPixmap(pWindow,pPixmap) \ - dixSetPrivate(&(pWindow)->devPrivates, cwWindowKey, pPixmap) - -#define cwDrawableIsRedirWindow(pDraw) \ - ((pDraw)->type == DRAWABLE_WINDOW && \ - getCwPixmap((WindowPtr) (pDraw)) != NULL) - -typedef struct { - /* - * screen func wrappers - */ - CloseScreenProcPtr CloseScreen; - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - CreateGCProcPtr CreateGC; - - CopyWindowProcPtr CopyWindow; - - GetWindowPixmapProcPtr GetWindowPixmap; - SetWindowPixmapProcPtr SetWindowPixmap; - - DestroyPictureProcPtr DestroyPicture; - ChangePictureClipProcPtr ChangePictureClip; - DestroyPictureClipProcPtr DestroyPictureClip; - - ChangePictureProcPtr ChangePicture; - ValidatePictureProcPtr ValidatePicture; - - CompositeProcPtr Composite; - CompositeRectsProcPtr CompositeRects; - - TrapezoidsProcPtr Trapezoids; - TrianglesProcPtr Triangles; - TriStripProcPtr TriStrip; - TriFanProcPtr TriFan; - - RasterizeTrapezoidProcPtr RasterizeTrapezoid; -} cwScreenRec, *cwScreenPtr; - -extern _X_EXPORT DevPrivateKey cwScreenKey; - -#define getCwScreen(pScreen) ((cwScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, cwScreenKey)) -#define setCwScreen(pScreen,p) dixSetPrivate(&(pScreen)->devPrivates, cwScreenKey, p) - -#define CW_OFFSET_XYPOINTS(ppt, npt) do { \ - DDXPointPtr _ppt = (DDXPointPtr)(ppt); \ - int _i; \ - for (_i = 0; _i < npt; _i++) { \ - _ppt[_i].x += dst_off_x; \ - _ppt[_i].y += dst_off_y; \ - } \ -} while (0) - -#define CW_OFFSET_RECTS(prect, nrect) do { \ - int _i; \ - for (_i = 0; _i < nrect; _i++) { \ - (prect)[_i].x += dst_off_x; \ - (prect)[_i].y += dst_off_y; \ - } \ -} while (0) - -#define CW_OFFSET_ARCS(parc, narc) do { \ - int _i; \ - for (_i = 0; _i < narc; _i++) { \ - (parc)[_i].x += dst_off_x; \ - (parc)[_i].y += dst_off_y; \ - } \ -} while (0) - -#define CW_OFFSET_XY_DST(x, y) do { \ - (x) = (x) + dst_off_x; \ - (y) = (y) + dst_off_y; \ -} while (0) - -#define CW_OFFSET_XY_SRC(x, y) do { \ - (x) = (x) + src_off_x; \ - (y) = (y) + src_off_y; \ -} while (0) - -/* cw.c */ -extern _X_EXPORT DrawablePtr -cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off); - -/* cw_render.c */ - -extern _X_EXPORT void -cwInitializeRender (ScreenPtr pScreen); - -extern _X_EXPORT void -cwFiniRender (ScreenPtr pScreen); - -/* cw.c */ - -extern _X_EXPORT void -miInitializeCompositeWrapper(ScreenPtr pScreen); +/*
+ * Copyright © 2004 Eric Anholt
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Eric Anholt not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Eric Anholt makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "gcstruct.h"
+#include "picturestr.h"
+#include "privates.h"
+
+/*
+ * One of these structures is allocated per GC that gets used with a window with
+ * backing pixmap.
+ */
+
+typedef struct {
+ GCPtr pBackingGC; /* Copy of the GC but with graphicsExposures
+ * set FALSE and the clientClip set to
+ * clip output to the valid regions of the
+ * backing pixmap. */
+ unsigned long serialNumber; /* clientClip computed time */
+ unsigned long stateChanges; /* changes in parent gc since last copy */
+ GCOps *wrapOps; /* wrapped ops */
+ GCFuncs *wrapFuncs; /* wrapped funcs */
+} cwGCRec, *cwGCPtr;
+
+extern _X_EXPORT DevPrivateKeyRec cwGCKeyRec;
+#define cwGCKey (&cwGCKeyRec)
+
+#define getCwGC(pGC) ((cwGCPtr)dixLookupPrivate(&(pGC)->devPrivates, cwGCKey))
+#define setCwGC(pGC,p) dixSetPrivate(&(pGC)->devPrivates, cwGCKey, p)
+
+/*
+ * One of these structures is allocated per Picture that gets used with a
+ * window with a backing pixmap
+ */
+
+typedef struct {
+ PicturePtr pBackingPicture;
+ unsigned long serialNumber;
+ unsigned long stateChanges;
+} cwPictureRec, *cwPicturePtr;
+
+extern _X_EXPORT DevPrivateKeyRec cwPictureKeyRec;
+#define cwPictureKey (&cwPictureKeyRec)
+
+#define getCwPicture(pPicture) (pPicture->pDrawable ? \
+ (cwPicturePtr)dixLookupPrivate(&(pPicture)->devPrivates, cwPictureKey) : 0)
+#define setCwPicture(pPicture,p) dixSetPrivate(&(pPicture)->devPrivates, cwPictureKey, p)
+
+extern _X_EXPORT DevPrivateKeyRec cwWindowKeyRec;
+#define cwWindowKey (&cwWindowKeyRec)
+
+#define cwWindowPrivate(pWin) dixLookupPrivate(&(pWin)->devPrivates, cwWindowKey)
+#define getCwPixmap(pWindow) ((PixmapPtr) cwWindowPrivate(pWindow))
+#define setCwPixmap(pWindow,pPixmap) \
+ dixSetPrivate(&(pWindow)->devPrivates, cwWindowKey, pPixmap)
+
+#define cwDrawableIsRedirWindow(pDraw) \
+ ((pDraw)->type == DRAWABLE_WINDOW && \
+ getCwPixmap((WindowPtr) (pDraw)) != NULL)
+
+typedef struct {
+ /*
+ * screen func wrappers
+ */
+ CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CreateGCProcPtr CreateGC;
+
+ CopyWindowProcPtr CopyWindow;
+
+ GetWindowPixmapProcPtr GetWindowPixmap;
+ SetWindowPixmapProcPtr SetWindowPixmap;
+
+ DestroyPictureProcPtr DestroyPicture;
+ ChangePictureClipProcPtr ChangePictureClip;
+ DestroyPictureClipProcPtr DestroyPictureClip;
+
+ ChangePictureProcPtr ChangePicture;
+ ValidatePictureProcPtr ValidatePicture;
+
+ CompositeProcPtr Composite;
+ CompositeRectsProcPtr CompositeRects;
+
+ TrapezoidsProcPtr Trapezoids;
+ TrianglesProcPtr Triangles;
+ TriStripProcPtr TriStrip;
+ TriFanProcPtr TriFan;
+
+ RasterizeTrapezoidProcPtr RasterizeTrapezoid;
+} cwScreenRec, *cwScreenPtr;
+
+extern _X_EXPORT DevPrivateKeyRec cwScreenKeyRec;
+#define cwScreenKey (&cwScreenKeyRec)
+
+#define getCwScreen(pScreen) ((cwScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, cwScreenKey))
+#define setCwScreen(pScreen,p) dixSetPrivate(&(pScreen)->devPrivates, cwScreenKey, p)
+
+#define CW_OFFSET_XYPOINTS(ppt, npt) do { \
+ DDXPointPtr _ppt = (DDXPointPtr)(ppt); \
+ int _i; \
+ for (_i = 0; _i < npt; _i++) { \
+ _ppt[_i].x += dst_off_x; \
+ _ppt[_i].y += dst_off_y; \
+ } \
+} while (0)
+
+#define CW_OFFSET_RECTS(prect, nrect) do { \
+ int _i; \
+ for (_i = 0; _i < nrect; _i++) { \
+ (prect)[_i].x += dst_off_x; \
+ (prect)[_i].y += dst_off_y; \
+ } \
+} while (0)
+
+#define CW_OFFSET_ARCS(parc, narc) do { \
+ int _i; \
+ for (_i = 0; _i < narc; _i++) { \
+ (parc)[_i].x += dst_off_x; \
+ (parc)[_i].y += dst_off_y; \
+ } \
+} while (0)
+
+#define CW_OFFSET_XY_DST(x, y) do { \
+ (x) = (x) + dst_off_x; \
+ (y) = (y) + dst_off_y; \
+} while (0)
+
+#define CW_OFFSET_XY_SRC(x, y) do { \
+ (x) = (x) + src_off_x; \
+ (y) = (y) + src_off_y; \
+} while (0)
+
+/* cw.c */
+extern _X_EXPORT DrawablePtr
+cwGetBackingDrawable(DrawablePtr pDrawable, int *x_off, int *y_off);
+
+/* cw_render.c */
+
+extern _X_EXPORT void
+cwInitializeRender (ScreenPtr pScreen);
+
+extern _X_EXPORT void
+cwFiniRender (ScreenPtr pScreen);
+
+/* cw.c */
+
+extern _X_EXPORT void
+miInitializeCompositeWrapper(ScreenPtr pScreen);
|