summaryrefslogtreecommitdiff
path: root/xserver/miext/damage/damage.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/miext/damage/damage.c
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/miext/damage/damage.c')
-rw-r--r--xserver/miext/damage/damage.c326
1 files changed, 185 insertions, 141 deletions
diff --git a/xserver/miext/damage/damage.c b/xserver/miext/damage/damage.c
index d311b1293..b9a15ee20 100644
--- a/xserver/miext/damage/damage.c
+++ b/xserver/miext/damage/damage.c
@@ -1,6 +1,4 @@
/*
- * $Id: damage.c,v 1.1 2006/11/26 18:15:04 matthieu Exp $
- *
* Copyright © 2003 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@@ -67,11 +65,16 @@
#define DAMAGE_DEBUG(x)
#endif
-#define getPixmapDamageRef(pPixmap) \
- ((DamagePtr *) &(pPixmap->devPrivates[damagePixPrivateIndex].ptr))
+#define getPixmapDamageRef(pPixmap) ((DamagePtr *) \
+ dixLookupPrivateAddr(&(pPixmap)->devPrivates, damagePixPrivateKey))
#define pixmapDamage(pPixmap) damagePixPriv(pPixmap)
+static DevPrivateKey damageScrPrivateKey = &damageScrPrivateKey;
+static DevPrivateKey damagePixPrivateKey = &damagePixPrivateKey;
+static DevPrivateKey damageGCPrivateKey = &damageGCPrivateKey;
+static DevPrivateKey damageWinPrivateKey = &damageWinPrivateKey;
+
static DamagePtr *
getDrawableDamageRef (DrawablePtr pDrawable)
{
@@ -111,7 +114,53 @@ getDrawableDamageRef (DrawablePtr pDrawable)
#define winDamageRef(pWindow) \
DamagePtr *pPrev = (DamagePtr *) \
- &(pWindow->devPrivates[damageWinPrivateIndex].ptr)
+ dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
+
+static void
+DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
+{
+ BoxRec tmpBox;
+ RegionRec tmpRegion;
+ Bool was_empty;
+
+ switch (pDamage->damageLevel) {
+ case DamageReportRawRegion:
+ (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
+ break;
+ case DamageReportDeltaRegion:
+ REGION_NULL (pScreen, &tmpRegion);
+ REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage);
+ if (REGION_NOTEMPTY (pScreen, &tmpRegion)) {
+ REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
+ pDamageRegion);
+ (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
+ }
+ REGION_UNINIT(pScreen, &tmpRegion);
+ break;
+ case DamageReportBoundingBox:
+ tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage);
+ REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
+ pDamageRegion);
+ if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage))) {
+ (*pDamage->damageReport) (pDamage, &pDamage->damage,
+ pDamage->closure);
+ }
+ break;
+ case DamageReportNonEmpty:
+ was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage);
+ REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
+ pDamageRegion);
+ if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage)) {
+ (*pDamage->damageReport) (pDamage, &pDamage->damage,
+ pDamage->closure);
+ }
+ break;
+ case DamageReportNone:
+ REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
+ pDamageRegion);
+ break;
+ }
+}
#if DAMAGE_DEBUG_ENABLE
static void
@@ -130,9 +179,6 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
RegionRec clippedRec;
RegionPtr pDamageRegion;
RegionRec pixClip;
- Bool was_empty;
- RegionRec tmpRegion;
- BoxRec tmpBox;
int draw_x, draw_y;
#ifdef COMPOSITE
int screen_x = 0, screen_y = 0;
@@ -196,9 +242,6 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
if (pDamage->pDrawable->type == DRAWABLE_WINDOW &&
!((WindowPtr) (pDamage->pDrawable))->realized)
{
-#if 0
- DAMAGE_DEBUG (("damage while window unrealized\n"));
-#endif
continue;
}
@@ -256,41 +299,18 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
*/
if (draw_x || draw_y)
REGION_TRANSLATE (pScreen, pDamageRegion, -draw_x, -draw_y);
-
- switch (pDamage->damageLevel) {
- case DamageReportRawRegion:
- (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
- break;
- case DamageReportDeltaRegion:
- REGION_NULL (pScreen, &tmpRegion);
- REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage);
- if (REGION_NOTEMPTY (pScreen, &tmpRegion))
- {
- REGION_UNION(pScreen, &pDamage->damage,
- &pDamage->damage, pDamageRegion);
- (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
- }
- REGION_UNINIT(pScreen, &tmpRegion);
- break;
- case DamageReportBoundingBox:
- tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage);
- REGION_UNION(pScreen, &pDamage->damage,
- &pDamage->damage, pDamageRegion);
- if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage)))
- (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure);
- break;
- case DamageReportNonEmpty:
- was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage);
- REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
- pDamageRegion);
- if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage))
- (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure);
- break;
- case DamageReportNone:
- REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage,
- pDamageRegion);
- break;
+
+ /* If the damage rec has been flagged to report damage after the op has
+ * completed, then union it into the delayed damage region, which will
+ * be used for reporting after calling down, and skip the reporting
+ */
+ if (!pDamage->reportAfter) {
+ DamageReportDamage (pDamage, pDamageRegion);
+ } else {
+ REGION_UNION(pScreen, &pDamage->pendingDamage,
+ &pDamage->pendingDamage, pDamageRegion);
}
+
/*
* translate original region back
*/
@@ -305,6 +325,21 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
REGION_UNINIT (pScreen, &clippedRec);
}
+static void
+damageReportPostOp (DrawablePtr pDrawable)
+{
+ drawableDamage(pDrawable);
+
+ for (; pDamage != NULL; pDamage = pDamage->pNext)
+ {
+ if (pDamage->reportAfter) {
+ DamageReportDamage (pDamage, &pDamage->pendingDamage);
+ REGION_EMPTY (pScreen, &pDamage->pendingDamage);
+ }
+ }
+
+}
+
#if DAMAGE_DEBUG_ENABLE
#define damageDamageBox(d,b,m) _damageDamageBox(d,b,m,__FUNCTION__)
static void
@@ -333,12 +368,12 @@ static void damageChangeClip(GCPtr, int, pointer, int);
static void damageDestroyClip(GCPtr);
static void damageCopyClip(GCPtr, GCPtr);
-GCFuncs damageGCFuncs = {
+static GCFuncs damageGCFuncs = {
damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC,
damageChangeClip, damageDestroyClip, damageCopyClip
};
-extern GCOps damageGCOps;
+static GCOps damageGCOps;
static Bool
damageCreateGC(GCPtr pGC)
@@ -550,6 +585,7 @@ damageComposite (CARD8 op,
yDst,
width,
height);
+ damageReportPostOp (pDst->pDrawable);
wrap (pScrPriv, ps, Composite, damageComposite);
}
@@ -616,8 +652,61 @@ damageGlyphs (CARD8 op,
}
unwrap (pScrPriv, ps, Glyphs);
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+ damageReportPostOp (pDst->pDrawable);
wrap (pScrPriv, ps, Glyphs, damageGlyphs);
}
+
+static void
+damageAddTraps (PicturePtr pPicture,
+ INT16 x_off,
+ INT16 y_off,
+ int ntrap,
+ xTrap *traps)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ damageScrPriv(pScreen);
+
+ if (checkPictureDamage (pPicture))
+ {
+ BoxRec box;
+ int i;
+ int x, y;
+ xTrap *t = traps;
+
+ box.x1 = 32767;
+ box.y1 = 32767;
+ box.x2 = -32767;
+ box.y2 = -32767;
+ x = pPicture->pDrawable->x + x_off;
+ y = pPicture->pDrawable->y + y_off;
+ for (i = 0; i < ntrap; i++)
+ {
+ pixman_fixed_t l = min (t->top.l, t->bot.l);
+ pixman_fixed_t r = max (t->top.r, t->bot.r);
+ int x1 = x + pixman_fixed_to_int (l);
+ int x2 = x + pixman_fixed_to_int (pixman_fixed_ceil (r));
+ int y1 = y + pixman_fixed_to_int (t->top.y);
+ int y2 = y + pixman_fixed_to_int (pixman_fixed_ceil (t->bot.y));
+
+ if (x1 < box.x1)
+ box.x1 = x1;
+ if (x2 > box.x2)
+ box.x2 = x2;
+ if (y1 < box.y1)
+ box.y1 = y1;
+ if (y2 > box.y2)
+ box.y2 = y2;
+ }
+ TRIM_PICTURE_BOX (box, pPicture);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox (pPicture->pDrawable, &box, pPicture->subWindowMode);
+ }
+ unwrap (pScrPriv, ps, AddTraps);
+ (*ps->AddTraps) (pPicture, x_off, y_off, ntrap, traps);
+ damageReportPostOp (pPicture->pDrawable);
+ wrap (pScrPriv, ps, AddTraps, damageAddTraps);
+}
#endif
/**********************************************************/
@@ -668,6 +757,7 @@ damageFillSpans(DrawablePtr pDrawable,
(*pGC->ops->FillSpans)(pDrawable, pGC, npt, ppt, pwidth, fSorted);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -715,6 +805,7 @@ damageSetSpans(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->SetSpans)(pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -746,6 +837,7 @@ damagePutImage(DrawablePtr pDrawable,
}
(*pGC->ops->PutImage)(pDrawable, pGC, depth, x, y, w, h,
leftPad, format, pImage);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -789,6 +881,7 @@ damageCopyArea(DrawablePtr pSrc,
ret = (*pGC->ops->CopyArea)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty);
+ damageReportPostOp (pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret;
}
@@ -834,6 +927,7 @@ damageCopyPlane(DrawablePtr pSrc,
ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ damageReportPostOp (pDst);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret;
}
@@ -875,6 +969,7 @@ damagePolyPoint(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->PolyPoint)(pDrawable, pGC, mode, npt, ppt);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -948,6 +1043,7 @@ damagePolylines(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->Polylines)(pDrawable, pGC, mode, npt, ppt);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1026,6 +1122,7 @@ damagePolySegment(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->PolySegment)(pDrawable, pGC, nSeg, pSeg);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1087,6 +1184,7 @@ damagePolyRectangle(DrawablePtr pDrawable,
}
}
(*pGC->ops->PolyRectangle)(pDrawable, pGC, nRects, pRects);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1139,6 +1237,7 @@ damagePolyArc(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->PolyArc)(pDrawable, pGC, nArcs, pArcs);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1197,6 +1296,7 @@ damageFillPolygon(DrawablePtr pDrawable,
}
(*pGC->ops->FillPolygon)(pDrawable, pGC, shape, mode, npt, ppt);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1235,6 +1335,7 @@ damagePolyFillRect(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->PolyFillRect)(pDrawable, pGC, nRects, pRects);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1276,6 +1377,7 @@ damagePolyFillArc(DrawablePtr pDrawable,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->PolyFillArc)(pDrawable, pGC, nArcs, pArcs);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1345,7 +1447,7 @@ damageText (DrawablePtr pDrawable,
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
- charinfo = (CharInfoPtr *) ALLOCATE_LOCAL(count * sizeof(CharInfoPtr));
+ charinfo = (CharInfoPtr *) xalloc(count * sizeof(CharInfoPtr));
if (!charinfo)
return x;
@@ -1367,7 +1469,7 @@ damageText (DrawablePtr pDrawable,
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, n, charinfo,
FONTGLYPHS(pGC->font));
}
- DEALLOCATE_LOCAL(charinfo);
+ xfree(charinfo);
return x + w;
}
@@ -1386,6 +1488,7 @@ damagePolyText8(DrawablePtr pDrawable,
Linear8Bit, TT_POLY8);
else
x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x;
}
@@ -1406,6 +1509,7 @@ damagePolyText16(DrawablePtr pDrawable,
TT_POLY16);
else
x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x;
}
@@ -1425,6 +1529,7 @@ damageImageText8(DrawablePtr pDrawable,
Linear8Bit, TT_IMAGE8);
else
(*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1444,6 +1549,7 @@ damageImageText16(DrawablePtr pDrawable,
TT_IMAGE16);
else
(*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1462,6 +1568,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable,
nglyph, ppci, TRUE, pGC->subWindowMode);
(*pGC->ops->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph,
ppci, pglyphBase);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1479,6 +1586,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable,
nglyph, ppci, FALSE, pGC->subWindowMode);
(*pGC->ops->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph,
ppci, pglyphBase);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1512,6 +1620,7 @@ damagePushPixels(GCPtr pGC,
damageDamageBox (pDrawable, &box, pGC->subWindowMode);
}
(*pGC->ops->PushPixels)(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
+ damageReportPostOp (pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -1574,33 +1683,6 @@ damageDestroyPixmap (PixmapPtr pPixmap)
}
static void
-damagePaintWindow(WindowPtr pWindow,
- RegionPtr prgn,
- int what)
-{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- damageScrPriv(pScreen);
-
- /*
- * Painting background none doesn't actually *do* anything, so
- * no damage is recorded
- */
- if ((what != PW_BACKGROUND || pWindow->backgroundState != None) &&
- getWindowDamage (pWindow))
- damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1);
- if(what == PW_BACKGROUND) {
- unwrap (pScrPriv, pScreen, PaintWindowBackground);
- (*pScreen->PaintWindowBackground) (pWindow, prgn, what);
- wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow);
- } else {
- unwrap (pScrPriv, pScreen, PaintWindowBorder);
- (*pScreen->PaintWindowBorder) (pWindow, prgn, what);
- wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow);
- }
-}
-
-
-static void
damageCopyWindow(WindowPtr pWindow,
DDXPointRec ptOldOrg,
RegionPtr prgnSrc)
@@ -1623,10 +1705,11 @@ damageCopyWindow(WindowPtr pWindow,
}
unwrap (pScrPriv, pScreen, CopyWindow);
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
+ damageReportPostOp (&pWindow->drawable);
wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
}
-GCOps damageGCOps = {
+static GCOps damageGCOps = {
damageFillSpans, damageSetSpans,
damagePutImage, damageCopyArea,
damageCopyPlane, damagePolyPoint,
@@ -1641,24 +1724,6 @@ GCOps damageGCOps = {
};
static void
-damageRestoreAreas (PixmapPtr pPixmap,
- RegionPtr prgn,
- int xorg,
- int yorg,
- WindowPtr pWindow)
-{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- damageScrPriv(pScreen);
-
- damageDamageRegion (&pWindow->drawable, prgn, FALSE, -1);
- unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas);
- (*pScreen->BackingStoreFuncs.RestoreAreas) (pPixmap, prgn,
- xorg, yorg, pWindow);
- wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas,
- damageRestoreAreas);
-}
-
-static void
damageSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
{
DamagePtr pDamage;
@@ -1717,21 +1782,12 @@ damageCloseScreen (int i, ScreenPtr pScreen)
unwrap (pScrPriv, pScreen, DestroyPixmap);
unwrap (pScrPriv, pScreen, CreateGC);
- unwrap (pScrPriv, pScreen, PaintWindowBackground);
- unwrap (pScrPriv, pScreen, PaintWindowBorder);
unwrap (pScrPriv, pScreen, CopyWindow);
unwrap (pScrPriv, pScreen, CloseScreen);
- unwrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas);
xfree (pScrPriv);
return (*pScreen->CloseScreen) (i, pScreen);
}
-int damageScrPrivateIndex;
-int damagePixPrivateIndex;
-int damageGCPrivateIndex;
-int damageWinPrivateIndex;
-int damageGeneration;
-
Bool
DamageSetup (ScreenPtr pScreen)
{
@@ -1740,67 +1796,34 @@ DamageSetup (ScreenPtr pScreen)
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
#endif
- if (damageGeneration != serverGeneration)
- {
- damageScrPrivateIndex = AllocateScreenPrivateIndex ();
- if (damageScrPrivateIndex == -1)
- return FALSE;
- damageGCPrivateIndex = AllocateGCPrivateIndex ();
- if (damageGCPrivateIndex == -1)
- return FALSE;
- damagePixPrivateIndex = AllocatePixmapPrivateIndex ();
- if (damagePixPrivateIndex == -1)
- return FALSE;
- damageWinPrivateIndex = AllocateWindowPrivateIndex ();
- if (damageWinPrivateIndex == -1)
- return FALSE;
- damageGeneration = serverGeneration;
- }
- if (pScreen->devPrivates[damageScrPrivateIndex].ptr)
+ if (dixLookupPrivate(&pScreen->devPrivates, damageScrPrivateKey))
return TRUE;
- if (!AllocateGCPrivate (pScreen, damageGCPrivateIndex, sizeof (DamageGCPrivRec)))
- return FALSE;
- if (!AllocatePixmapPrivate (pScreen, damagePixPrivateIndex, 0))
- return FALSE;
- if (!AllocateWindowPrivate (pScreen, damageWinPrivateIndex, 0))
+ if (!dixRequestPrivate(damageGCPrivateKey, sizeof(DamageGCPrivRec)))
return FALSE;
pScrPriv = (DamageScrPrivPtr) xalloc (sizeof (DamageScrPrivRec));
if (!pScrPriv)
return FALSE;
-#ifdef COMPOSITE
- /* This is a kludge to ensure wrapping order with the composite wrapper.
- * If it's done from compinit.c, then DamageSetup may be called before the
- * extension init phase, so that cw will be higher in the wrapping chain and
- * rewrite drawables before damage gets to it, causing confusion.
- */
- if (!noCompositeExtension)
- miInitializeCompositeWrapper (pScreen);
-#endif
-
pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0;
wrap (pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
wrap (pScrPriv, pScreen, CreateGC, damageCreateGC);
- wrap (pScrPriv, pScreen, PaintWindowBackground, damagePaintWindow);
- wrap (pScrPriv, pScreen, PaintWindowBorder, damagePaintWindow);
wrap (pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
wrap (pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
wrap (pScrPriv, pScreen, CopyWindow, damageCopyWindow);
wrap (pScrPriv, pScreen, CloseScreen, damageCloseScreen);
- wrap (pScrPriv, pScreen, BackingStoreFuncs.RestoreAreas,
- damageRestoreAreas);
#ifdef RENDER
if (ps) {
wrap (pScrPriv, ps, Glyphs, damageGlyphs);
wrap (pScrPriv, ps, Composite, damageComposite);
+ wrap (pScrPriv, ps, AddTraps, damageAddTraps);
}
#endif
- pScreen->devPrivates[damageScrPrivateIndex].ptr = (pointer) pScrPriv;
+ dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, pScrPriv);
return TRUE;
}
@@ -1820,12 +1843,14 @@ DamageCreate (DamageReportFunc damageReport,
pDamage->pNext = 0;
pDamage->pNextWin = 0;
REGION_NULL(pScreen, &pDamage->damage);
+ REGION_NULL(pScreen, &pDamage->pendingDamage);
pDamage->damageLevel = damageLevel;
pDamage->isInternal = isInternal;
pDamage->closure = closure;
pDamage->isWindow = FALSE;
pDamage->pDrawable = 0;
+ pDamage->reportAfter = FALSE;
pDamage->damageReport = damageReport;
pDamage->damageDestroy = damageDestroy;
@@ -1909,6 +1934,7 @@ DamageDestroy (DamagePtr pDamage)
if (pDamage->damageDestroy)
(*pDamage->damageDestroy) (pDamage, pDamage->closure);
REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage);
+ REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->pendingDamage);
xfree (pDamage);
}
@@ -1957,9 +1983,27 @@ DamageRegion (DamagePtr pDamage)
return &pDamage->damage;
}
+_X_EXPORT RegionPtr
+DamagePendingRegion (DamagePtr pDamage)
+{
+ return &pDamage->pendingDamage;
+}
+
_X_EXPORT void
DamageDamageRegion (DrawablePtr pDrawable,
RegionPtr pRegion)
{
damageDamageRegion (pDrawable, pRegion, FALSE, -1);
+
+ /* Go back and report this damage for DamagePtrs with reportAfter set, since
+ * this call isn't part of an in-progress drawing op in the call chain and
+ * the DDX probably just wants to know about it right away.
+ */
+ damageReportPostOp (pDrawable);
+}
+
+void
+DamageSetReportAfterOp (DamagePtr pDamage, Bool reportAfter)
+{
+ pDamage->reportAfter = reportAfter;
}