damage: Make damageRegionProcessPending take a damage not a drawable

In the case where there's no damage monitor on the drawable, we look
that fact up twice: once before rendering to decide whether to compute
damage, and again after to decide whether to append it. This is wasted
effort, as the layer below us is effectively not allowed to change
whether there's a damage monitor for the drawable, but there's no way
the compiler can know that.

Instead, look it up once up front, and change the check macros and
damageRegionProcessPending to take a damage not a drawable.

v2: Explicitly pass pDamage to the macros as well (Michel Dänzer)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
Adam Jackson 2016-05-03 11:24:58 -04:00
parent 1bb932bf14
commit 4e124203f2

View File

@ -282,10 +282,8 @@ damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
} }
static void static void
damageRegionProcessPending(DrawablePtr pDrawable) damageRegionProcessPending(DamagePtr pDamage)
{ {
drawableDamage(pDrawable);
for (; pDamage != NULL; pDamage = pDamage->pNext) { for (; pDamage != NULL; pDamage = pDamage->pNext) {
if (pDamage->reportAfter) { if (pDamage->reportAfter) {
/* It's possible that there is only interest in postRendering reporting. */ /* It's possible that there is only interest in postRendering reporting. */
@ -360,6 +358,7 @@ damageCreateGC(GCPtr pGC)
#define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \ #define DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable) \
damageGCPriv(pGC); \ damageGCPriv(pGC); \
drawableDamage(pDrawable); \
const GCFuncs *oldFuncs = pGC->funcs; \ const GCFuncs *oldFuncs = pGC->funcs; \
unwrap(pGCPriv, pGC, funcs); \ unwrap(pGCPriv, pGC, funcs); \
unwrap(pGCPriv, pGC, ops); \ unwrap(pGCPriv, pGC, ops); \
@ -457,7 +456,7 @@ damageDestroyClip(GCPtr pGC)
#define BOX_NOT_EMPTY(box) \ #define BOX_NOT_EMPTY(box) \
(((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0)) (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
#define checkGCDamage(d,g) (getDrawableDamage(d) && \ #define checkGCDamage(d,g) (d && \
(!g->pCompositeClip ||\ (!g->pCompositeClip ||\
RegionNotEmpty(g->pCompositeClip))) RegionNotEmpty(g->pCompositeClip)))
@ -469,8 +468,7 @@ damageDestroyClip(GCPtr pGC)
if(box.y2 > extents->y2) box.y2 = extents->y2; \ if(box.y2 > extents->y2) box.y2 = extents->y2; \
} }
#define checkPictureDamage(p) (getDrawableDamage(p->pDrawable) && \ #define checkPictureDamage(d, p) (d && RegionNotEmpty(p->pCompositeClip))
RegionNotEmpty(p->pCompositeClip))
static void static void
damageComposite(CARD8 op, damageComposite(CARD8 op,
@ -487,8 +485,9 @@ damageComposite(CARD8 op,
PictureScreenPtr ps = GetPictureScreen(pScreen); PictureScreenPtr ps = GetPictureScreen(pScreen);
damageScrPriv(pScreen); damageScrPriv(pScreen);
drawableDamage(pDst->pDrawable);
if (checkPictureDamage(pDst)) { if (checkPictureDamage(pDamage, pDst)) {
BoxRec box; BoxRec box;
box.x1 = xDst + pDst->pDrawable->x; box.x1 = xDst + pDst->pDrawable->x;
@ -505,7 +504,7 @@ damageComposite(CARD8 op,
pMask, pMask,
pDst, pDst,
xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
damageRegionProcessPending(pDst->pDrawable); damageRegionProcessPending(pDamage);
wrap(pScrPriv, ps, Composite, damageComposite); wrap(pScrPriv, ps, Composite, damageComposite);
} }
@ -521,8 +520,9 @@ damageGlyphs(CARD8 op,
PictureScreenPtr ps = GetPictureScreen(pScreen); PictureScreenPtr ps = GetPictureScreen(pScreen);
damageScrPriv(pScreen); damageScrPriv(pScreen);
drawableDamage(pDst->pDrawable);
if (checkPictureDamage(pDst)) { if (checkPictureDamage(pDamage, pDst)) {
int nlistTmp = nlist; int nlistTmp = nlist;
GlyphListPtr listTmp = list; GlyphListPtr listTmp = list;
GlyphPtr *glyphsTmp = glyphs; GlyphPtr *glyphsTmp = glyphs;
@ -567,7 +567,7 @@ damageGlyphs(CARD8 op,
} }
unwrap(pScrPriv, ps, Glyphs); unwrap(pScrPriv, ps, Glyphs);
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
damageRegionProcessPending(pDst->pDrawable); damageRegionProcessPending(pDamage);
wrap(pScrPriv, ps, Glyphs, damageGlyphs); wrap(pScrPriv, ps, Glyphs, damageGlyphs);
} }
@ -579,8 +579,9 @@ damageAddTraps(PicturePtr pPicture,
PictureScreenPtr ps = GetPictureScreen(pScreen); PictureScreenPtr ps = GetPictureScreen(pScreen);
damageScrPriv(pScreen); damageScrPriv(pScreen);
drawableDamage(pPicture->pDrawable);
if (checkPictureDamage(pPicture)) { if (checkPictureDamage(pDamage, pPicture)) {
BoxRec box; BoxRec box;
int i; int i;
int x, y; int x, y;
@ -615,7 +616,7 @@ damageAddTraps(PicturePtr pPicture,
} }
unwrap(pScrPriv, ps, AddTraps); unwrap(pScrPriv, ps, AddTraps);
(*ps->AddTraps) (pPicture, x_off, y_off, ntrap, traps); (*ps->AddTraps) (pPicture, x_off, y_off, ntrap, traps);
damageRegionProcessPending(pPicture->pDrawable); damageRegionProcessPending(pDamage);
wrap(pScrPriv, ps, AddTraps, damageAddTraps); wrap(pScrPriv, ps, AddTraps, damageAddTraps);
} }
@ -627,7 +628,7 @@ damageFillSpans(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (npt && checkGCDamage(pDrawable, pGC)) { if (npt && checkGCDamage(pDamage, pGC)) {
int nptTmp = npt; int nptTmp = npt;
DDXPointPtr pptTmp = ppt; DDXPointPtr pptTmp = ppt;
int *pwidthTmp = pwidth; int *pwidthTmp = pwidth;
@ -663,7 +664,7 @@ damageFillSpans(DrawablePtr pDrawable,
(*pGC->ops->FillSpans) (pDrawable, pGC, npt, ppt, pwidth, fSorted); (*pGC->ops->FillSpans) (pDrawable, pGC, npt, ppt, pwidth, fSorted);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -675,7 +676,7 @@ damageSetSpans(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (npt && checkGCDamage(pDrawable, pGC)) { if (npt && checkGCDamage(pDamage, pGC)) {
DDXPointPtr pptTmp = ppt; DDXPointPtr pptTmp = ppt;
int *pwidthTmp = pwidth; int *pwidthTmp = pwidth;
int nptTmp = npt; int nptTmp = npt;
@ -709,7 +710,7 @@ damageSetSpans(DrawablePtr pDrawable,
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->SetSpans) (pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted); (*pGC->ops->SetSpans) (pDrawable, pGC, pcharsrc, ppt, pwidth, npt, fSorted);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -721,7 +722,7 @@ damagePutImage(DrawablePtr pDrawable,
int y, int w, int h, int leftPad, int format, char *pImage) int y, int w, int h, int leftPad, int format, char *pImage)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (checkGCDamage(pDrawable, pGC)) { if (checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
box.x1 = x + pDrawable->x; box.x1 = x + pDrawable->x;
@ -735,7 +736,7 @@ damagePutImage(DrawablePtr pDrawable,
} }
(*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h,
leftPad, format, pImage); leftPad, format, pImage);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -749,7 +750,7 @@ damageCopyArea(DrawablePtr pSrc,
DAMAGE_GC_OP_PROLOGUE(pGC, pDst); DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
if (checkGCDamage(pDst, pGC)) { if (checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
box.x1 = dstx + pDst->x; box.x1 = dstx + pDst->x;
@ -764,7 +765,7 @@ damageCopyArea(DrawablePtr pSrc,
ret = (*pGC->ops->CopyArea) (pSrc, pDst, ret = (*pGC->ops->CopyArea) (pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty); pGC, srcx, srcy, width, height, dstx, dsty);
damageRegionProcessPending(pDst); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret; return ret;
} }
@ -782,7 +783,7 @@ damageCopyPlane(DrawablePtr pSrc,
DAMAGE_GC_OP_PROLOGUE(pGC, pDst); DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
if (checkGCDamage(pDst, pGC)) { if (checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
box.x1 = dstx + pDst->x; box.x1 = dstx + pDst->x;
@ -798,7 +799,7 @@ damageCopyPlane(DrawablePtr pSrc,
ret = (*pGC->ops->CopyPlane) (pSrc, pDst, ret = (*pGC->ops->CopyPlane) (pSrc, pDst,
pGC, srcx, srcy, width, height, dstx, dsty, pGC, srcx, srcy, width, height, dstx, dsty,
bitPlane); bitPlane);
damageRegionProcessPending(pDst); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDst); DAMAGE_GC_OP_EPILOGUE(pGC, pDst);
return ret; return ret;
} }
@ -809,7 +810,7 @@ damagePolyPoint(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (npt && checkGCDamage(pDrawable, pGC)) { if (npt && checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
int nptTmp = npt; int nptTmp = npt;
xPoint *pptTmp = ppt; xPoint *pptTmp = ppt;
@ -839,7 +840,7 @@ damagePolyPoint(DrawablePtr pDrawable,
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, ppt); (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, ppt);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -849,7 +850,7 @@ damagePolylines(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (npt && checkGCDamage(pDrawable, pGC)) { if (npt && checkGCDamage(pDamage, pGC)) {
int nptTmp = npt; int nptTmp = npt;
DDXPointPtr pptTmp = ppt; DDXPointPtr pptTmp = ppt;
BoxRec box; BoxRec box;
@ -912,7 +913,7 @@ damagePolylines(DrawablePtr pDrawable,
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt); (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppt);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -921,7 +922,7 @@ damagePolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSeg, xSegment * pSeg)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (nSeg && checkGCDamage(pDrawable, pGC)) { if (nSeg && checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
int extra = pGC->lineWidth; int extra = pGC->lineWidth;
int nsegTmp = nSeg; int nsegTmp = nSeg;
@ -991,7 +992,7 @@ damagePolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSeg, xSegment * pSeg)
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolySegment) (pDrawable, pGC, nSeg, pSeg); (*pGC->ops->PolySegment) (pDrawable, pGC, nSeg, pSeg);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1001,7 +1002,7 @@ damagePolyRectangle(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (nRects && checkGCDamage(pDrawable, pGC)) { if (nRects && checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
int offset1, offset2, offset3; int offset1, offset2, offset3;
int nRectsTmp = nRects; int nRectsTmp = nRects;
@ -1050,7 +1051,7 @@ damagePolyRectangle(DrawablePtr pDrawable,
} }
} }
(*pGC->ops->PolyRectangle) (pDrawable, pGC, nRects, pRects); (*pGC->ops->PolyRectangle) (pDrawable, pGC, nRects, pRects);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1059,7 +1060,7 @@ damagePolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (nArcs && checkGCDamage(pDrawable, pGC)) { if (nArcs && checkGCDamage(pDamage, pGC)) {
int extra = pGC->lineWidth >> 1; int extra = pGC->lineWidth >> 1;
BoxRec box; BoxRec box;
int nArcsTmp = nArcs; int nArcsTmp = nArcs;
@ -1097,7 +1098,7 @@ damagePolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyArc) (pDrawable, pGC, nArcs, pArcs); (*pGC->ops->PolyArc) (pDrawable, pGC, nArcs, pArcs);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1107,7 +1108,7 @@ damageFillPolygon(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (npt > 2 && checkGCDamage(pDrawable, pGC)) { if (npt > 2 && checkGCDamage(pDamage, pGC)) {
DDXPointPtr pptTmp = ppt; DDXPointPtr pptTmp = ppt;
int nptTmp = npt; int nptTmp = npt;
BoxRec box; BoxRec box;
@ -1156,7 +1157,7 @@ damageFillPolygon(DrawablePtr pDrawable,
} }
(*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, npt, ppt); (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, npt, ppt);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1165,7 +1166,7 @@ damagePolyFillRect(DrawablePtr pDrawable,
GCPtr pGC, int nRects, xRectangle *pRects) GCPtr pGC, int nRects, xRectangle *pRects)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (nRects && checkGCDamage(pDrawable, pGC)) { if (nRects && checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
xRectangle *pRectsTmp = pRects; xRectangle *pRectsTmp = pRects;
int nRectsTmp = nRects; int nRectsTmp = nRects;
@ -1192,7 +1193,7 @@ damagePolyFillRect(DrawablePtr pDrawable,
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyFillRect) (pDrawable, pGC, nRects, pRects); (*pGC->ops->PolyFillRect) (pDrawable, pGC, nRects, pRects);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1201,7 +1202,7 @@ damagePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (nArcs && checkGCDamage(pDrawable, pGC)) { if (nArcs && checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
int nArcsTmp = nArcs; int nArcsTmp = nArcs;
xArc *pArcsTmp = pArcs; xArc *pArcsTmp = pArcs;
@ -1228,7 +1229,7 @@ damagePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc * pArcs)
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PolyFillArc) (pDrawable, pGC, nArcs, pArcs); (*pGC->ops->PolyFillArc) (pDrawable, pGC, nArcs, pArcs);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1277,12 +1278,9 @@ damageDamageChars(DrawablePtr pDrawable,
#define TT_IMAGE16 3 #define TT_IMAGE16 3
static void static void
damageText(DrawablePtr pDrawable, damageText(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned long count,
GCPtr pGC, char *chars, FontEncoding fontEncoding, DamagePtr pDamage,
int x, Bool textType)
int y,
unsigned long count,
char *chars, FontEncoding fontEncoding, Bool textType)
{ {
CharInfoPtr *charinfo; CharInfoPtr *charinfo;
unsigned long i; unsigned long i;
@ -1291,7 +1289,7 @@ damageText(DrawablePtr pDrawable,
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
if (!checkGCDamage(pDrawable, pGC)) if (!pDamage)
return; return;
charinfo = xallocarray(count, sizeof(CharInfoPtr)); charinfo = xallocarray(count, sizeof(CharInfoPtr));
@ -1316,9 +1314,9 @@ damagePolyText8(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit,
TT_POLY8); pDamage, TT_POLY8);
x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
} }
@ -1330,9 +1328,9 @@ damagePolyText16(DrawablePtr pDrawable,
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_POLY16); pDamage, TT_POLY16);
x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
} }
@ -1343,9 +1341,9 @@ damageImageText8(DrawablePtr pDrawable,
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit,
TT_IMAGE8); pDamage, TT_IMAGE8);
(*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1356,9 +1354,9 @@ damageImageText16(DrawablePtr pDrawable,
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_IMAGE16); pDamage, TT_IMAGE16);
(*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1373,7 +1371,7 @@ damageImageGlyphBlt(DrawablePtr pDrawable,
damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
nglyph, ppci, TRUE, pGC->subWindowMode); nglyph, ppci, TRUE, pGC->subWindowMode);
(*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1388,7 +1386,7 @@ damagePolyGlyphBlt(DrawablePtr pDrawable,
damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y,
nglyph, ppci, FALSE, pGC->subWindowMode); nglyph, ppci, FALSE, pGC->subWindowMode);
(*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1398,7 +1396,7 @@ damagePushPixels(GCPtr pGC,
DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (checkGCDamage(pDrawable, pGC)) { if (checkGCDamage(pDamage, pGC)) {
BoxRec box; BoxRec box;
box.x1 = xOrg; box.x1 = xOrg;
@ -1417,7 +1415,7 @@ damagePushPixels(GCPtr pGC,
damageDamageBox(pDrawable, &box, pGC->subWindowMode); damageDamageBox(pDrawable, &box, pGC->subWindowMode);
} }
(*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1482,6 +1480,7 @@ damageCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
ScreenPtr pScreen = pWindow->drawable.pScreen; ScreenPtr pScreen = pWindow->drawable.pScreen;
damageScrPriv(pScreen); damageScrPriv(pScreen);
drawableDamage(&pWindow->drawable);
if (getWindowDamage(pWindow)) { if (getWindowDamage(pWindow)) {
int dx = pWindow->drawable.x - ptOldOrg.x; int dx = pWindow->drawable.x - ptOldOrg.x;
@ -1497,7 +1496,7 @@ damageCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
} }
unwrap(pScrPriv, pScreen, CopyWindow); unwrap(pScrPriv, pScreen, CopyWindow);
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
damageRegionProcessPending(&pWindow->drawable); damageRegionProcessPending(pDamage);
wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow); wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
} }
@ -1871,20 +1870,22 @@ DamageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion)
void void
DamageRegionProcessPending(DrawablePtr pDrawable) DamageRegionProcessPending(DrawablePtr pDrawable)
{ {
damageRegionProcessPending(pDrawable); drawableDamage(pDrawable);
damageRegionProcessPending(pDamage);
} }
/* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */ /* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */
void void
DamageDamageRegion(DrawablePtr pDrawable, RegionPtr pRegion) DamageDamageRegion(DrawablePtr pDrawable, RegionPtr pRegion)
{ {
drawableDamage(pDrawable);
damageRegionAppend(pDrawable, pRegion, FALSE, -1); damageRegionAppend(pDrawable, pRegion, FALSE, -1);
/* Go back and report this damage for DamagePtrs with reportAfter set, since /* 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 * 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. * the DDX probably just wants to know about it right away.
*/ */
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDamage);
} }
void void