OSDN Git Service

Fix glyph cropping bug
authorChet Haase <chet@google.com>
Fri, 17 Aug 2012 22:44:44 +0000 (15:44 -0700)
committerChet Haase <chet@google.com>
Fri, 17 Aug 2012 23:03:27 +0000 (16:03 -0700)
Glyphs were being stored in the glyph cache incorrectly.
The second row of glyphs in any column were being positioned exactly
one pixel too high, causing the preceding glyph in that column to be
cropped, resulting in the reported truncation in some glyphs.

Issue #7003215 Minor UI truncation while reading the mails

Change-Id: I47ce376f78a04d4e07e8b7ed1b3f0b58864c5498

libs/hwui/FontRenderer.cpp

index caeeb87..27e198c 100644 (file)
@@ -148,8 +148,8 @@ bool CacheTexture::fitBitmap(const SkGlyph& glyph, uint32_t *retOriginX, uint32_
                 cacheBlock->mX += roundedUpW;
                 if (mHeight - glyphH >= glyphH) {
                     // There's enough height left over to create a new CacheBlock
-                    CacheBlock *newBlock = new CacheBlock(oldX, glyphH, roundedUpW,
-                            mHeight - glyphH);
+                    CacheBlock *newBlock = new CacheBlock(oldX, glyphH + TEXTURE_BORDER_SIZE,
+                            roundedUpW, mHeight - glyphH - TEXTURE_BORDER_SIZE);
 #if DEBUG_FONT_RENDERER
                     ALOGD("fitBitmap: Created new block: this, x, y, w, h = %p, %d, %d, %d, %d",
                             newBlock, newBlock->mX, newBlock->mY,