diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c index 169763f..a05e897 100644 --- a/exa/exa_glyphs.c +++ b/exa/exa_glyphs.c @@ -768,26 +777,26 @@ exaGlyphs (CARD8 op, CARD32 component_alpha; ExaGlyphBuffer buffer; - /* If we don't have a mask format but all the glyphs have the same format - * and don't intersect, use the glyph format as mask format for the full - * benefits of the glyph cache. + /* If we don't have a mask format or it doesn't match the glyph format, but + * all the glyphs have the same format and don't intersect, use the glyph + * format as mask format for the full benefits of the glyph cache. */ - if (!maskFormat) { + if (!maskFormat || (NeedsComponent(maskFormat->format) && + !NeedsComponent(list[0].format->format))) { Bool sameFormat = TRUE; + PictFormatPtr format = list[0].format; int i; - maskFormat = list[0].format; - for (i = 0; i < nlist; i++) { - if (maskFormat->format != list[i].format->format) { + if (format->format != list[i].format->format) { sameFormat = FALSE; break; } } - if (!sameFormat || (maskFormat->depth != 1 && - exaGlyphsIntersect(nlist, list, glyphs))) { - maskFormat = NULL; + if (sameFormat && (maskFormat || format->depth == 1 || + !exaGlyphsIntersect(nlist, list, glyphs))) { + maskFormat = format; } }