summaryrefslogtreecommitdiff
path: root/miext/cw
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-08-12 08:11:59 +0000
committerEric Anholt <anholt@freebsd.org>2004-08-12 08:11:59 +0000
commit6e0228722cc2fa37a0e2359bc3dab3646e36c4b7 (patch)
treed7782eefdbe4e77b09ae874138770c2d91555413 /miext/cw
parent789cf3ed846045d91f950cb177ef6bae4c8966fc (diff)
Fix various cw issues, including a couple reported by deronj:
- Fix wrapping of GC ops/funcs according to policy described in bug #1045. - Remove ValidateGC/ValidatePictures on the redirected drawables/pictures -- it's not needed, and DDXs shouldn't be seeing redirected drawables in render or GC ops/funcs when cw is running. - Mark all GC/Picture state as dirty when moving from redirected to non-redirected, since it hadn't been passed down in Change* or Validate* while redirected. - Remove CreatePicture wrapper that didn't do anything. - Comment on why AddTraps wrapper isn't needed.
Diffstat (limited to 'miext/cw')
-rw-r--r--miext/cw/cw.c43
-rw-r--r--miext/cw/cw.h4
-rw-r--r--miext/cw/cw_ops.c3
-rw-r--r--miext/cw/cw_render.c39
4 files changed, 41 insertions, 48 deletions
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index 4a73d8be2..0b89c1b7b 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -163,19 +163,28 @@ cwDestroyGCPrivate(GCPtr pGC)
FreeGC(pPriv->pBackingGC, (XID)0);
setCwGC (pGC, pPriv->wrapFuncs);
xfree((pointer)pPriv);
+ /* The ChangeGC and ValidateGCs on the window haven't been passed down the
+ * stack, so report all state being changed.
+ */
+ pGC->stateChanges |= (1 << (GCLastBit + 1)) - 1;
+ (*pGC->funcs->ChangeGC)(pGC, (1 << (GCLastBit + 1)) - 1);
}
/* GCFuncs wrappers. These only get used when the drawable is a window with a
* backing pixmap, to avoid the overhead in the non-window-backing-pixmap case.
*/
-#define FUNC_PROLOGUE(pGC, pPriv) \
- ((pGC)->funcs = pPriv->wrapFuncs), \
- ((pGC)->ops = pPriv->wrapOps)
+#define FUNC_PROLOGUE(pGC, pPriv) do { \
+ (pGC)->funcs = (pPriv)->wrapFuncs; \
+ (pGC)->ops = (pPriv)->wrapOps; \
+} while (0)
-#define FUNC_EPILOGUE(pGC, pPriv) \
- ((pGC)->funcs = &cwGCFuncs), \
- ((pGC)->ops = &cwGCOps)
+#define FUNC_EPILOGUE(pGC, pPriv) do { \
+ (pPriv)->wrapFuncs = (pGC)->funcs; \
+ (pPriv)->wrapOps = (pGC)->ops; \
+ (pGC)->funcs = &cwGCFuncs; \
+ (pGC)->ops = &cwGCOps; \
+} while (0)
static void
cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
@@ -199,13 +208,6 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
(*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);
return;
}
- (*pGC->funcs->ValidateGC)(pGC, stateChanges, pDrawable);
-
- /*
- * rewrap funcs and ops as Validate may have changed them
- */
- pPriv->wrapFuncs = pGC->funcs;
- pPriv->wrapOps = pGC->ops;
pBackingGC = pPriv->pBackingGC;
pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
@@ -332,8 +334,10 @@ cwDestroyClip(GCPtr pGC)
#define CHEAP_FUNC_PROLOGUE(pGC) \
((pGC)->funcs = (GCFuncs *)(pGC)->devPrivates[cwGCIndex].ptr)
-#define CHEAP_FUNC_EPILOGUE(pGC) \
- ((pGC)->funcs = &cwCheapGCFuncs)
+#define CHEAP_FUNC_EPILOGUE(pGC) do { \
+ (pGC)->devPrivates[cwGCIndex].ptr = (pointer)(pGC)->funcs; \
+ (pGC)->funcs = &cwCheapGCFuncs; \
+} while (0)
static void
cwCheapValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
@@ -425,12 +429,13 @@ cwCheapDestroyClip(GCPtr pGC)
* GC validation on BackingStore windows.
*/
-#define SCREEN_PROLOGUE(pScreen, field)\
+#define SCREEN_PROLOGUE(pScreen, field) \
((pScreen)->field = getCwScreen(pScreen)->field)
-#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
- ((getCwScreen(pScreen)->field = (pScreen)->field), \
- ((pScreen)->field = (wrapper)))
+#define SCREEN_EPILOGUE(pScreen, field, wrapper) do { \
+ getCwScreen(pScreen)->field = (pScreen)->field; \
+ (pScreen)->field = (wrapper); \
+} while (0)
static Bool
cwCreateGC(GCPtr pGC)
diff --git a/miext/cw/cw.h b/miext/cw/cw.h
index 3871d9ec0..037237005 100644
--- a/miext/cw/cw.h
+++ b/miext/cw/cw.h
@@ -64,7 +64,6 @@ typedef struct {
PaintWindowBorderProcPtr PaintWindowBorder;
#ifdef RENDER
- CreatePictureProcPtr CreatePicture;
DestroyPictureProcPtr DestroyPicture;
ChangePictureClipProcPtr ChangePictureClip;
DestroyPictureClipProcPtr DestroyPictureClip;
@@ -82,9 +81,6 @@ typedef struct {
TriFanProcPtr TriFan;
RasterizeTrapezoidProcPtr RasterizeTrapezoid;
-#if 0
- AddTrapsProcPtr AddTraps;
-#endif
#endif
} cwScreenRec, *cwScreenPtr;
diff --git a/miext/cw/cw_ops.c b/miext/cw/cw_ops.c
index 0b7626917..85816ddd6 100644
--- a/miext/cw/cw_ops.c
+++ b/miext/cw/cw_ops.c
@@ -26,7 +26,6 @@
#define SETUP_BACKING_DST(_pDst, _pGC) \
cwGCPtr pGCPrivate = getCwGC (_pGC); \
- GCFuncs *oldFuncs = (_pGC)->funcs; \
GCPtr pBackingGC = pGCPrivate->pBackingGC; \
int dst_off_x, dst_off_y; \
DrawablePtr pBackingDst = cwGetBackingDrawable(pDst, &dst_off_x, \
@@ -39,13 +38,11 @@
#define PROLOGUE(pGC) do { \
pGC->ops = pGCPrivate->wrapOps;\
- pGC->funcs = pGCPrivate->wrapFuncs; \
} while (0)
#define EPILOGUE(pGC) do { \
pGCPrivate->wrapOps = (pGC)->ops; \
(pGC)->ops = &cwGCOps; \
- (pGC)->funcs = oldFuncs; \
} while (0)
/*
diff --git a/miext/cw/cw_render.c b/miext/cw/cw_render.c
index 8e4ae9cdd..285ad4f96 100644
--- a/miext/cw/cw_render.c
+++ b/miext/cw/cw_render.c
@@ -74,6 +74,8 @@ cwCreateBackingPicture (PicturePtr pPicture)
pBackingPicture = CreatePicture (0, &pPixmap->drawable, pPicture->pFormat,
0, 0, serverClient, &error);
+ if (!pBackingPicture)
+ return NULL;
pPicture->devPrivates[cwPictureIndex].ptr = pBackingPicture;
@@ -117,19 +119,6 @@ cwGetBackingPicture (PicturePtr pPicture, int *x_off, int *y_off)
return pPicture;
}
}
-
-static int
-cwCreatePicture (PicturePtr pPicture)
-{
- int ret;
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- cwPsDecl(pScreen);
-
- cwPsUnwrap (CreatePicture);
- ret = (*ps->CreatePicture) (pPicture);
- cwPsWrap (CreatePicture, cwCreatePicture);
- return ret;
-}
static void
cwDestroyPicture (PicturePtr pPicture)
@@ -141,6 +130,11 @@ cwDestroyPicture (PicturePtr pPicture)
cwDestroyBackingPicture (pPicture);
(*ps->DestroyPicture) (pPicture);
cwPsWrap(DestroyPicture, cwDestroyPicture);
+ /* The ChangePicture and ValidatePictures on the window haven't been passed
+ * down the stack, so report all state being changed.
+ */
+ pPicture->stateChanges |= (1 << (CPLastBit + 1)) - 1;
+ (*ps->ChangePicture) (pPicture, (1 << (CPLastBit + 1)) - 1);
}
static void
@@ -173,21 +167,21 @@ cwValidatePicture (PicturePtr pPicture,
cwPictureDecl;
cwPsUnwrap(ValidatePicture);
- (*ps->ValidatePicture) (pPicture, mask);
if (!cwDrawableIsRedirWindow (pPicture->pDrawable))
{
if (pBackingPicture)
cwDestroyBackingPicture (pPicture);
+ (*ps->ValidatePicture) (pPicture, mask);
}
else
{
- DrawablePtr pDrawable = pPicture->pDrawable;
- WindowPtr pWin = (WindowPtr) (pDrawable);
DrawablePtr pBackingDrawable;
int x_off, y_off;
- if (pBackingPicture && pBackingPicture->pDrawable !=
- &(*pScreen->GetWindowPixmap) ((WindowPtr) pPicture->pDrawable)->drawable)
+ pBackingDrawable = cwGetBackingDrawable(pPicture->pDrawable, &x_off,
+ &y_off);
+
+ if (pBackingPicture && pBackingPicture->pDrawable != pBackingDrawable)
{
cwDestroyBackingPicture (pPicture);
pBackingPicture = 0;
@@ -198,13 +192,12 @@ cwValidatePicture (PicturePtr pPicture,
pBackingPicture = cwCreateBackingPicture (pPicture);
if (!pBackingPicture)
{
+ (*ps->ValidatePicture) (pPicture, mask);
cwPsWrap(ValidatePicture, cwValidatePicture);
return;
}
}
- pBackingDrawable = cwGetBackingDrawable (&pWin->drawable, &x_off,&y_off);
-
SetPictureTransform(pBackingPicture, pPicture->transform);
/* XXX Set filters */
@@ -442,7 +435,6 @@ cwInitializeRender (ScreenPtr pScreen)
{
cwPsDecl (pScreen);
- cwPsWrap(CreatePicture, cwCreatePicture);
cwPsWrap(DestroyPicture, cwDestroyPicture);
cwPsWrap(ChangePicture, cwChangePicture);
cwPsWrap(ValidatePicture, cwValidatePicture);
@@ -453,6 +445,10 @@ cwInitializeRender (ScreenPtr pScreen)
cwPsWrap(Triangles, cwTriangles);
cwPsWrap(TriStrip, cwTriStrip);
cwPsWrap(TriFan, cwTriFan);
+ /* There is no need to wrap AddTraps as far as we can tell. AddTraps can
+ * only be done on alpha-only pictures, and we won't be getting
+ * alpha-only window pictures, so there's no need to translate.
+ */
}
void
@@ -460,7 +456,6 @@ cwFiniRender (ScreenPtr pScreen)
{
cwPsDecl (pScreen);
- cwPsUnwrap(CreatePicture);
cwPsUnwrap(DestroyPicture);
cwPsUnwrap(ChangePicture);
cwPsUnwrap(ValidatePicture);