damage: use DamageReportDamage for the initial borderClip damage report
Instead of using DamageDamageRegion for reporting the first (virtual) damage in ProcDamageCreate that covers the borderClip of the drawable window, use a function DamageReportDamage directly (previously called damageReportDamage). This avoids sending all other damage listeners a full window update when a new damage object is created. As this patch makes DamageReportDamage a public interface, the function has been moved into the part of the file that contains all the other public functions. The function has not been otherwise modified. Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
274dca8f2c
commit
e409fb32b9
|
@ -223,7 +223,7 @@ ProcDamageCreate (ClientPtr client)
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||||
{
|
{
|
||||||
pRegion = &((WindowPtr) pDrawable)->borderClip;
|
pRegion = &((WindowPtr) pDrawable)->borderClip;
|
||||||
DamageDamageRegion(pDrawable, pRegion);
|
DamageReportDamage(pDamageExt->pDamage, pRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
@ -120,54 +120,6 @@ getDrawableDamageRef (DrawablePtr pDrawable)
|
||||||
DamagePtr *pPrev = (DamagePtr *) \
|
DamagePtr *pPrev = (DamagePtr *) \
|
||||||
dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
|
dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey)
|
||||||
|
|
||||||
static void
|
|
||||||
damageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
|
|
||||||
{
|
|
||||||
BoxRec tmpBox;
|
|
||||||
RegionRec tmpRegion;
|
|
||||||
Bool was_empty;
|
|
||||||
|
|
||||||
switch (pDamage->damageLevel) {
|
|
||||||
case DamageReportRawRegion:
|
|
||||||
RegionUnion(&pDamage->damage, &pDamage->damage,
|
|
||||||
pDamageRegion);
|
|
||||||
(*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
|
|
||||||
break;
|
|
||||||
case DamageReportDeltaRegion:
|
|
||||||
RegionNull(&tmpRegion);
|
|
||||||
RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage);
|
|
||||||
if (RegionNotEmpty(&tmpRegion)) {
|
|
||||||
RegionUnion(&pDamage->damage, &pDamage->damage,
|
|
||||||
pDamageRegion);
|
|
||||||
(*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
|
|
||||||
}
|
|
||||||
RegionUninit(&tmpRegion);
|
|
||||||
break;
|
|
||||||
case DamageReportBoundingBox:
|
|
||||||
tmpBox = *RegionExtents(&pDamage->damage);
|
|
||||||
RegionUnion(&pDamage->damage, &pDamage->damage,
|
|
||||||
pDamageRegion);
|
|
||||||
if (!BOX_SAME (&tmpBox, RegionExtents(&pDamage->damage))) {
|
|
||||||
(*pDamage->damageReport) (pDamage, &pDamage->damage,
|
|
||||||
pDamage->closure);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DamageReportNonEmpty:
|
|
||||||
was_empty = !RegionNotEmpty(&pDamage->damage);
|
|
||||||
RegionUnion(&pDamage->damage, &pDamage->damage,
|
|
||||||
pDamageRegion);
|
|
||||||
if (was_empty && RegionNotEmpty(&pDamage->damage)) {
|
|
||||||
(*pDamage->damageReport) (pDamage, &pDamage->damage,
|
|
||||||
pDamage->closure);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DamageReportNone:
|
|
||||||
RegionUnion(&pDamage->damage, &pDamage->damage,
|
|
||||||
pDamageRegion);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
damageReportDamagePostRendering (DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pDamageRegion)
|
damageReportDamagePostRendering (DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pDamageRegion)
|
||||||
{
|
{
|
||||||
|
@ -360,7 +312,7 @@ damageRegionAppend (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip,
|
||||||
/* Report damage now, if desired. */
|
/* Report damage now, if desired. */
|
||||||
if (!pDamage->reportAfter) {
|
if (!pDamage->reportAfter) {
|
||||||
if (pDamage->damageReport)
|
if (pDamage->damageReport)
|
||||||
damageReportDamage (pDamage, pDamageRegion);
|
DamageReportDamage (pDamage, pDamageRegion);
|
||||||
else
|
else
|
||||||
RegionUnion(&pDamage->damage,
|
RegionUnion(&pDamage->damage,
|
||||||
&pDamage->damage, pDamageRegion);
|
&pDamage->damage, pDamageRegion);
|
||||||
|
@ -393,7 +345,7 @@ damageRegionProcessPending (DrawablePtr pDrawable)
|
||||||
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. */
|
||||||
if (pDamage->damageReport)
|
if (pDamage->damageReport)
|
||||||
damageReportDamage (pDamage, &pDamage->pendingDamage);
|
DamageReportDamage (pDamage, &pDamage->pendingDamage);
|
||||||
else
|
else
|
||||||
RegionUnion(&pDamage->damage, &pDamage->damage,
|
RegionUnion(&pDamage->damage, &pDamage->damage,
|
||||||
&pDamage->pendingDamage);
|
&pDamage->pendingDamage);
|
||||||
|
@ -2125,3 +2077,52 @@ DamageGetScreenFuncs (ScreenPtr pScreen)
|
||||||
damageScrPriv(pScreen);
|
damageScrPriv(pScreen);
|
||||||
return &pScrPriv->funcs;
|
return &pScrPriv->funcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion)
|
||||||
|
{
|
||||||
|
BoxRec tmpBox;
|
||||||
|
RegionRec tmpRegion;
|
||||||
|
Bool was_empty;
|
||||||
|
|
||||||
|
switch (pDamage->damageLevel) {
|
||||||
|
case DamageReportRawRegion:
|
||||||
|
RegionUnion(&pDamage->damage, &pDamage->damage,
|
||||||
|
pDamageRegion);
|
||||||
|
(*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure);
|
||||||
|
break;
|
||||||
|
case DamageReportDeltaRegion:
|
||||||
|
RegionNull(&tmpRegion);
|
||||||
|
RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage);
|
||||||
|
if (RegionNotEmpty(&tmpRegion)) {
|
||||||
|
RegionUnion(&pDamage->damage, &pDamage->damage,
|
||||||
|
pDamageRegion);
|
||||||
|
(*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure);
|
||||||
|
}
|
||||||
|
RegionUninit(&tmpRegion);
|
||||||
|
break;
|
||||||
|
case DamageReportBoundingBox:
|
||||||
|
tmpBox = *RegionExtents(&pDamage->damage);
|
||||||
|
RegionUnion(&pDamage->damage, &pDamage->damage,
|
||||||
|
pDamageRegion);
|
||||||
|
if (!BOX_SAME (&tmpBox, RegionExtents(&pDamage->damage))) {
|
||||||
|
(*pDamage->damageReport) (pDamage, &pDamage->damage,
|
||||||
|
pDamage->closure);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DamageReportNonEmpty:
|
||||||
|
was_empty = !RegionNotEmpty(&pDamage->damage);
|
||||||
|
RegionUnion(&pDamage->damage, &pDamage->damage,
|
||||||
|
pDamageRegion);
|
||||||
|
if (was_empty && RegionNotEmpty(&pDamage->damage)) {
|
||||||
|
(*pDamage->damageReport) (pDamage, &pDamage->damage,
|
||||||
|
pDamage->closure);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DamageReportNone:
|
||||||
|
RegionUnion(&pDamage->damage, &pDamage->damage,
|
||||||
|
pDamageRegion);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,10 @@ DamageRegionProcessPending (DrawablePtr pDrawable);
|
||||||
extern _X_EXPORT void
|
extern _X_EXPORT void
|
||||||
DamageRegionRendered (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion);
|
DamageRegionRendered (DrawablePtr pDrawable, DamagePtr pDamage, RegionPtr pOldDamage, RegionPtr pRegion);
|
||||||
|
|
||||||
|
/* Call this when you create a new Damage and you wish to send an initial damage message (to it). */
|
||||||
|
extern _X_EXPORT void
|
||||||
|
DamageReportDamage (DamagePtr pDamage, RegionPtr pDamageRegion);
|
||||||
|
|
||||||
/* Avoid using this call, it only exists for API compatibility. */
|
/* Avoid using this call, it only exists for API compatibility. */
|
||||||
extern _X_EXPORT void
|
extern _X_EXPORT void
|
||||||
DamageDamageRegion (DrawablePtr pDrawable,
|
DamageDamageRegion (DrawablePtr pDrawable,
|
||||||
|
|
Loading…
Reference in New Issue