hw/xwin: Use pre-computed extent of damage for creating GDI region

When -clipupdates option is specified, use the pre-computed extent of damage,
rather than computing a GDI region which combines all the individual boxes in
the damage.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2012-02-10 13:36:46 +00:00
parent 3ab95a2a5c
commit 9b10f20f47
3 changed files with 13 additions and 30 deletions

View File

@ -489,7 +489,7 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
POINT ptOrigin;
DWORD dwBox = RegionNumRects(damage);
BoxPtr pBox = RegionRects(damage);
HRGN hrgnTemp = NULL, hrgnCombined = NULL;
HRGN hrgnCombined = NULL;
/*
* Return immediately if the app is not active
@ -551,15 +551,9 @@ winShadowUpdateDD(ScreenPtr pScreen, shadowBufPtr pBuf)
BoxPtr pBoxExtents = RegionExtents(damage);
/* Compute a GDI region from the damaged region */
hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
dwBox--;
pBox++;
while (dwBox--) {
hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
DeleteObject(hrgnTemp);
pBox++;
}
hrgnCombined =
CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
pBoxExtents->y2);
/* Install the GDI region as a clipping region */
SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);

View File

@ -523,7 +523,7 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
POINT ptOrigin;
DWORD dwBox = RegionNumRects(damage);
BoxPtr pBox = RegionRects(damage);
HRGN hrgnTemp = NULL, hrgnCombined = NULL;
HRGN hrgnCombined = NULL;
/*
* Return immediately if the app is not active
@ -595,15 +595,9 @@ winShadowUpdateDDNL(ScreenPtr pScreen, shadowBufPtr pBuf)
BoxPtr pBoxExtents = RegionExtents(damage);
/* Compute a GDI region from the damaged region */
hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
dwBox--;
pBox++;
while (dwBox--) {
hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
DeleteObject(hrgnTemp);
pBox++;
}
hrgnCombined =
CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
pBoxExtents->y2);
/* Install the GDI region as a clipping region */
SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);

View File

@ -439,7 +439,7 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
DWORD dwBox = RegionNumRects(damage);
BoxPtr pBox = RegionRects(damage);
int x, y, w, h;
HRGN hrgnTemp = NULL, hrgnCombined = NULL;
HRGN hrgnCombined = NULL;
#ifdef XWIN_UPDATESTATS
static DWORD s_dwNonUnitRegions = 0;
@ -500,16 +500,11 @@ winShadowUpdateGDI(ScreenPtr pScreen, shadowBufPtr pBuf)
}
}
else if (!pScreenInfo->fMultiWindow) {
/* Compute a GDI region from the damaged region */
hrgnCombined = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
dwBox--;
pBox++;
while (dwBox--) {
hrgnTemp = CreateRectRgn(pBox->x1, pBox->y1, pBox->x2, pBox->y2);
CombineRgn(hrgnCombined, hrgnCombined, hrgnTemp, RGN_OR);
DeleteObject(hrgnTemp);
pBox++;
}
hrgnCombined =
CreateRectRgn(pBoxExtents->x1, pBoxExtents->y1, pBoxExtents->x2,
pBoxExtents->y2);
/* Install the GDI region as a clipping region */
SelectClipRgn(pScreenPriv->hdcScreen, hrgnCombined);