diff options
author | Digish Pandya <digishp@codeaurora.org> | 2014-05-09 15:05:16 +0530 |
---|---|---|
committer | Digish Pandya <digishp@codeaurora.org> | 2014-05-09 15:05:16 +0530 |
commit | b9312a54e49f2f0e35bf65f91d796eeb3a6084bc (patch) | |
tree | 4ff17549ae22a5d060c61e45d43002dded0b348c /libs/hwui | |
parent | 678f7edd140f3914655bc600d207d3dcb986f881 (diff) | |
download | frameworks_base-b9312a54e49f2f0e35bf65f91d796eeb3a6084bc.zip frameworks_base-b9312a54e49f2f0e35bf65f91d796eeb3a6084bc.tar.gz frameworks_base-b9312a54e49f2f0e35bf65f91d796eeb3a6084bc.tar.bz2 |
Correct stride for drawing to cached glyph bitmap
fixes the glyph cachebuffer index to account for pixelbuffer
format size.
issue: in launcher home screen create icon group and rename the
group to some text string with emo-icons (smilies). without this
change the drop shadows for emo-icons will look bad.
Change-Id: I525a9219d35f4541363fd64e7fc5fd1053269725
Signed-off-by: Digish Pandya <digishp@codeaurora.org>
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/font/Font.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp index 8f5beb8..b493298 100644 --- a/libs/hwui/font/Font.cpp +++ b/libs/hwui/font/Font.cpp @@ -212,18 +212,28 @@ void Font::drawCachedGlyphBitmap(CachedGlyphInfo* glyph, int x, int y, uint8_t* int dstY = y + glyph->mBitmapTop; CacheTexture* cacheTexture = glyph->mCacheTexture; + PixelBuffer* pixelBuffer = cacheTexture->getPixelBuffer(); + uint32_t formatSize = PixelBuffer::formatSize(pixelBuffer->getFormat()); uint32_t cacheWidth = cacheTexture->getWidth(); - uint32_t startY = glyph->mStartY * cacheWidth; - uint32_t endY = startY + (glyph->mBitmapHeight * cacheWidth); + uint32_t srcStride = formatSize * cacheWidth; + uint32_t startY = glyph->mStartY * srcStride; + uint32_t endY = startY + (glyph->mBitmapHeight * srcStride); - PixelBuffer* pixelBuffer = cacheTexture->getPixelBuffer(); const uint8_t* cacheBuffer = pixelBuffer->map(); for (uint32_t cacheY = startY, bitmapY = dstY * bitmapWidth; cacheY < endY; - cacheY += cacheWidth, bitmapY += bitmapWidth) { - memcpy(&bitmap[bitmapY + dstX], &cacheBuffer[cacheY + glyph->mStartX], glyph->mBitmapWidth); + cacheY += srcStride, bitmapY += bitmapWidth) { + + if (formatSize == 1) { + memcpy(&bitmap[bitmapY + dstX], &cacheBuffer[cacheY + glyph->mStartX], glyph->mBitmapWidth); + } else { + for (uint32_t i = 0; i < glyph->mBitmapWidth; ++i) { + bitmap[bitmapY + dstX + i] = cacheBuffer[cacheY + (glyph->mStartX + i)*formatSize]; + } + } } + } void Font::drawCachedGlyph(CachedGlyphInfo* glyph, float x, float hOffset, float vOffset, |