damage: Don't rewrite Text ops to GlyphBlt ops

There's no particularly good reason to, and it breaks Xnest.

Bugzilla: http://bugs.freedesktop.org/2454
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2013-08-21 11:13:11 -04:00
parent d08966227e
commit 0f3f8e4295

View File

@ -1336,7 +1336,7 @@ damageDamageChars(DrawablePtr pDrawable,
#define TT_POLY16 2 #define TT_POLY16 2
#define TT_IMAGE16 3 #define TT_IMAGE16 3
static int static void
damageText(DrawablePtr pDrawable, damageText(DrawablePtr pDrawable,
GCPtr pGC, GCPtr pGC,
int x, int x,
@ -1345,39 +1345,29 @@ damageText(DrawablePtr pDrawable,
char *chars, FontEncoding fontEncoding, Bool textType) char *chars, FontEncoding fontEncoding, Bool textType)
{ {
CharInfoPtr *charinfo; CharInfoPtr *charinfo;
CharInfoPtr *info;
unsigned long i; unsigned long i;
unsigned int n; unsigned int n;
int w;
Bool imageblt; Bool imageblt;
imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16);
if (!checkGCDamage(pDrawable, pGC))
return;
charinfo = malloc(count * sizeof(CharInfoPtr)); charinfo = malloc(count * sizeof(CharInfoPtr));
if (!charinfo) if (!charinfo)
return x; return;
GetGlyphs(pGC->font, count, (unsigned char *) chars, GetGlyphs(pGC->font, count, (unsigned char *) chars,
fontEncoding, &i, charinfo); fontEncoding, &i, charinfo);
n = (unsigned int) i; n = (unsigned int) i;
w = 0;
if (!imageblt)
for (info = charinfo; i--; info++)
w += (*info)->metrics.characterWidth;
if (n != 0) { if (n != 0) {
damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, damageDamageChars(pDrawable, pGC->font, x + pDrawable->x,
y + pDrawable->y, n, charinfo, imageblt, y + pDrawable->y, n, charinfo, imageblt,
pGC->subWindowMode); pGC->subWindowMode);
if (imageblt)
(*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, n, charinfo,
FONTGLYPHS(pGC->font));
else
(*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, n, charinfo,
FONTGLYPHS(pGC->font));
} }
free(charinfo); free(charinfo);
return x + w;
} }
static int static int
@ -1385,12 +1375,9 @@ damagePolyText8(DrawablePtr pDrawable,
GCPtr pGC, int x, int y, int count, char *chars) GCPtr pGC, int x, int y, int count, char *chars)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit,
if (checkGCDamage(pDrawable, pGC)) TT_POLY8);
x = damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
Linear8Bit, TT_POLY8);
else
x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
@ -1401,14 +1388,10 @@ damagePolyText16(DrawablePtr pDrawable,
GCPtr pGC, int x, int y, int count, unsigned short *chars) GCPtr pGC, int x, int y, int count, unsigned short *chars)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
if (checkGCDamage(pDrawable, pGC)) FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
x = damageText(pDrawable, pGC, x, y, (unsigned long) count, TT_POLY16);
(char *) chars, x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_POLY16);
else
x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x; return x;
@ -1419,12 +1402,9 @@ damageImageText8(DrawablePtr pDrawable,
GCPtr pGC, int x, int y, int count, char *chars) GCPtr pGC, int x, int y, int count, char *chars)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit,
if (checkGCDamage(pDrawable, pGC)) TT_IMAGE8);
damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
Linear8Bit, TT_IMAGE8);
else
(*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }
@ -1434,13 +1414,10 @@ damageImageText16(DrawablePtr pDrawable,
GCPtr pGC, int x, int y, int count, unsigned short *chars) GCPtr pGC, int x, int y, int count, unsigned short *chars)
{ {
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
if (checkGCDamage(pDrawable, pGC)) FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, TT_IMAGE16);
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
TT_IMAGE16);
else
(*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
damageRegionProcessPending(pDrawable); damageRegionProcessPending(pDrawable);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
} }