[xserver-commit] xserver/miext/damage damage.c,1.9,1.10
Keith Packard
xserver-commit@pdx.freedesktop.org
Mon, 01 Dec 2003 23:11:49 -0800
Committed by: keithp
Update of /cvs/xserver/xserver/miext/damage
In directory pdx:/tmp/cvs-serv16409/miext/damage
Modified Files:
damage.c
Log Message:
* miext/damage/damage.c: (damageComposite), (damageGlyphs),
(damageFillSpans), (damageSetSpans), (damagePutImage),
(damageCopyArea), (damageCopyPlane), (damagePolyPoint),
(damagePolylines), (damagePolySegment), (damagePolyRectangle),
(damagePolyArc), (damageFillPolygon), (damagePolyFillRect),
(damagePolyFillArc), (damagePolyText8), (damagePolyText16),
(damageImageText8), (damageImageText16), (damagePushPixels):
Trim damage to CompositeClips for GC and Picture ops.
* os/io.c: (FlushAllOutput):
Trust SmartSchedule to run each slice long enough and make
FlushAllOutput actually flush, even with pending requests.
Index: damage.c
===================================================================
RCS file: /cvs/xserver/xserver/miext/damage/damage.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- damage.c 22 Nov 2003 00:49:11 -0000 1.9
+++ damage.c 2 Dec 2003 07:11:47 -0000 1.10
@@ -239,30 +239,6 @@
REGION_UNINIT (pDrawable->pScreen, ®ion);
}
-#if DAMAGE_DEBUG_ENABLE
-#define damageDamageRect(d,x,y,w,h) _damageDamageRect(d,x,y,w,h,__FUNCTION__)
-static void
-_damageDamageRect (DrawablePtr pDrawable, int x, int y, int w, int h, char *where)
-#else
-static void
-damageDamageRect (DrawablePtr pDrawable, int x, int y, int w, int h)
-#endif
-{
- BoxRec box;
-
- x += pDrawable->x;
- y += pDrawable->y;
- box.x1 = x;
- box.x2 = x + w;
- box.y1 = y;
- box.y2 = y + h;
-#if DAMAGE_DEBUG_ENABLE
- _damageDamageBox (pDrawable, &box, where);
-#else
- damageDamageBox (pDrawable, &box);
-#endif
-}
-
static void damageValidateGC(GCPtr, unsigned long, DrawablePtr);
static void damageChangeGC(GCPtr, unsigned long);
static void damageCopyGC(GCPtr, unsigned long, GCPtr);
@@ -426,7 +402,22 @@
#define BOX_NOT_EMPTY(box) \
(((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0))
+#define checkGCDamage(d,g) (getDrawableDamage(d) && \
+ REGION_NOTEMPTY(pScreen, g->pCompositeClip))
+
#ifdef RENDER
+
+#define TRIM_PICTURE_BOX(box, pDst) { \
+ BoxPtr extents = &pDst->pCompositeClip->extents;\
+ if(box.x1 < extents->x1) box.x1 = extents->x1; \
+ if(box.x2 > extents->x2) box.x2 = extents->x2; \
+ if(box.y1 < extents->y1) box.y1 = extents->y1; \
+ if(box.y2 > extents->y2) box.y2 = extents->y2; \
+ }
+
+#define checkPictureDamage(p) (getDrawableDamage(p->pDrawable) && \
+ REGION_NOTEMPTY(pScreen, p->pCompositeClip))
+
static void
damageComposite (CARD8 op,
PicturePtr pSrc,
@@ -445,8 +436,18 @@
PictureScreenPtr ps = GetPictureScreen(pScreen);
damageScrPriv(pScreen);
- if (getDrawableDamage (pDst->pDrawable))
- damageDamageRect (pDst->pDrawable, xDst, yDst, width, height);
+ if (checkPictureDamage (pDst))
+ {
+ BoxRec box;
+
+ box.x1 = xDst + pDst->pDrawable->x;
+ box.y1 = yDst + pDst->pDrawable->y;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+ TRIM_PICTURE_BOX(box, pDst);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox (pDst->pDrawable, &box);
+ }
unwrap (pScrPriv, ps, Composite);
(*ps->Composite) (op,
pSrc,
@@ -478,7 +479,7 @@
PictureScreenPtr ps = GetPictureScreen(pScreen);
damageScrPriv(pScreen);
- if (getDrawableDamage (pDst->pDrawable))
+ if (checkPictureDamage (pDst))
{
int nlistTmp = nlist;
GlyphListPtr listTmp = list;
@@ -486,8 +487,15 @@
int x, y;
int n;
GlyphPtr glyph;
- x = xSrc;
- y = ySrc;
+ BoxRec box;
+ int x1, y1, x2, y2;
+
+ box.x1 = 32767;
+ box.y1 = 32767;
+ box.x2 = -32767;
+ box.y2 = -32767;
+ x = pDst->pDrawable->x;
+ y = pDst->pDrawable->y;
while (nlistTmp--)
{
x += listTmp->xOff;
@@ -496,16 +504,26 @@
while (n--)
{
glyph = *glyphsTmp++;
- damageDamageRect (pDst->pDrawable,
- x - glyph->info.x,
- y - glyph->info.y,
- glyph->info.width,
- glyph->info.height);
+ x1 = x - glyph->info.x;
+ y1 = y - glyph->info.y;
+ x2 = x1 + glyph->info.width;
+ y2 = y1 + glyph->info.height;
+ if (x1 < box.x1)
+ box.x1 = x1;
+ if (y1 < box.y1)
+ box.y1 = y1;
+ if (x2 > box.x2)
+ box.x2 = x2;
+ if (y2 > box.y2)
+ box.y2 = y2;
x += glyph->info.xOff;
y += glyph->info.yOff;
}
listTmp++;
}
+ TRIM_PICTURE_BOX (box, pDst);
+ if (BOX_NOT_EMPTY(box))
+ damageDamageBox (pDst->pDrawable, &box);
}
unwrap (pScrPriv, ps, Glyphs);
(*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
@@ -526,7 +544,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && getDrawableDamage (pDrawable))
+ if (npt && checkGCDamage (pDrawable, pGC))
{
int nptTmp = npt;
DDXPointPtr pptTmp = ppt;
@@ -575,7 +593,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && getDrawableDamage (pDrawable))
+ if (npt && checkGCDamage (pDrawable, pGC))
{
DDXPointPtr pptTmp = ppt;
int *pwidthTmp = pwidth;
@@ -624,7 +642,7 @@
char *pImage)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (getDrawableDamage (pDrawable))
+ if (checkGCDamage (pDrawable, pGC))
{
BoxRec box;
@@ -656,7 +674,7 @@
RegionPtr ret;
DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
- if (getDrawableDamage (pDst))
+ if (checkGCDamage (pDst, pGC))
{
BoxRec box;
@@ -690,7 +708,7 @@
{
RegionPtr ret;
DAMAGE_GC_OP_PROLOGUE(pGC, pDst);
- if (getDrawableDamage (pDst))
+ if (checkGCDamage (pDst, pGC))
{
BoxRec box;
@@ -719,7 +737,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && getDrawableDamage (pDrawable))
+ if (npt && checkGCDamage (pDrawable, pGC))
{
BoxRec box;
int nptTmp = npt;
@@ -759,7 +777,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt && getDrawableDamage (pDrawable))
+ if (npt && checkGCDamage (pDrawable, pGC))
{
int nptTmp = npt;
DDXPointPtr pptTmp = ppt;
@@ -831,7 +849,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nSeg && getDrawableDamage (pDrawable))
+ if (nSeg && checkGCDamage (pDrawable, pGC))
{
BoxRec box;
int extra = pGC->lineWidth;
@@ -909,7 +927,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nRects && getDrawableDamage (pDrawable))
+ if (nRects && checkGCDamage (pDrawable, pGC))
{
BoxRec box;
int offset1, offset2, offset3;
@@ -970,7 +988,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nArcs && getDrawableDamage (pDrawable))
+ if (nArcs && checkGCDamage (pDrawable, pGC))
{
int extra = pGC->lineWidth >> 1;
BoxRec box;
@@ -1024,7 +1042,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (npt > 2 && getDrawableDamage (pDrawable))
+ if (npt > 2 && checkGCDamage (pDrawable, pGC))
{
DDXPointPtr pptTmp = ppt;
int nptTmp = npt;
@@ -1080,7 +1098,7 @@
xRectangle *pRects)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nRects && getDrawableDamage (pDrawable))
+ if (nRects && checkGCDamage (pDrawable, pGC))
{
BoxRec box;
xRectangle *pRectsTmp = pRects;
@@ -1119,7 +1137,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (nArcs && getDrawableDamage (pDrawable))
+ if (nArcs && checkGCDamage (pDrawable, pGC))
{
BoxRec box;
int nArcsTmp = nArcs;
@@ -1252,7 +1270,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (getDrawableDamage (pDrawable))
+ if (checkGCDamage (pDrawable, pGC))
damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
Linear8Bit, TT_POLY8);
else
@@ -1271,7 +1289,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (getDrawableDamage (pDrawable))
+ if (checkGCDamage (pDrawable, pGC))
damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_POLY16);
@@ -1291,7 +1309,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (getDrawableDamage (pDrawable))
+ if (checkGCDamage (pDrawable, pGC))
damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
Linear8Bit, TT_IMAGE8);
else
@@ -1309,7 +1327,7 @@
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if (getDrawableDamage (pDrawable))
+ if (checkGCDamage (pDrawable, pGC))
damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_IMAGE16);
@@ -1363,7 +1381,7 @@
int yOrg)
{
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
- if(getDrawableDamage (pDrawable))
+ if(checkGCDamage (pDrawable, pGC))
{
BoxRec box;