diff options
author | Owen Taylor <otaylor@huygens.home.fishsoup.net> | 2008-04-28 21:00:54 +0200 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2008-04-28 21:00:54 +0200 |
commit | fcb5949928f1c27f67f40c094c3c673786574422 (patch) | |
tree | 8fef0354bcf625765bbd45a0fc2b13feaf971ecc /exa/exa_glyphs.c | |
parent | 40eb14c9482457969e0bde97c49edad536285e02 (diff) |
EXA: Fix overlapping glyphs in glyph cache
Allocate each cache at a different vertical position in the
per-format pixmap. Fix width/height confusion when choosing
the cache for a glyph.
Diffstat (limited to 'exa/exa_glyphs.c')
-rw-r--r-- | exa/exa_glyphs.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c index 55fdb0197..851e43917 100644 --- a/exa/exa_glyphs.c +++ b/exa/exa_glyphs.c @@ -173,12 +173,13 @@ exaRealizeGlyphCaches(ScreenPtr pScreen, for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) { ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i]; int rows; - + if (cache->format != format) continue; - rows = (cache->size + cache->columns - 1) / cache->columns; + cache->yOffset = height; + rows = (cache->size + cache->columns - 1) / cache->columns; height += rows * cache->glyphHeight; } @@ -346,6 +347,9 @@ exaGlyphCacheHashRemove(ExaGlyphCachePtr cache, } } +#define CACHE_X(pos) (((pos) % cache->columns) * cache->glyphWidth) +#define CACHE_Y(pos) (cache->yOffset + ((pos) / cache->columns) * cache->glyphHeight) + static ExaGlyphCacheResult exaGlyphCacheBufferGlyph(ScreenPtr pScreen, ExaGlyphCachePtr cache, @@ -393,8 +397,8 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, int x, y; int i; - x = (pos % cache->columns) * cache->glyphWidth; - y = (pos / cache->columns) * cache->glyphHeight; + x = CACHE_X(pos); + y = CACHE_Y(pos); for (i = 0; i < buffer->count; i++) { if (buffer->rects[i].xSrc == x && buffer->rects[i].ySrc == y) { @@ -420,8 +424,8 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, cache->picture, 0, 0, 0, 0, - (pos % cache->columns) * cache->glyphWidth, - (pos / cache->columns) * cache->glyphHeight, + CACHE_X(pos), + CACHE_Y(pos), pGlyph->info.width, pGlyph->info.height); } @@ -430,8 +434,8 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, buffer->source = cache->picture; rect = &buffer->rects[buffer->count]; - rect->xSrc = (pos % cache->columns) * cache->glyphWidth; - rect->ySrc = (pos / cache->columns) * cache->glyphHeight; + rect->xSrc = CACHE_X(pos); + rect->ySrc = CACHE_Y(pos); rect->xDst = xGlyph - pGlyph->info.x; rect->yDst = yGlyph - pGlyph->info.y; rect->width = pGlyph->info.width; @@ -442,6 +446,9 @@ exaGlyphCacheBufferGlyph(ScreenPtr pScreen, return ExaGlyphSuccess; } +#undef CACHE_X +#undef CACHE_Y + static ExaGlyphCacheResult exaBufferGlyph(ScreenPtr pScreen, ExaGlyphBufferPtr buffer, @@ -452,7 +459,7 @@ exaBufferGlyph(ScreenPtr pScreen, ExaScreenPriv(pScreen); unsigned int format = (GlyphPicture(pGlyph)[pScreen->myNum])->format; int width = pGlyph->info.width; - int height = pGlyph->info.width; + int height = pGlyph->info.height; ExaCompositeRectPtr rect; PicturePtr source; int i; |