summaryrefslogtreecommitdiffstats
path: root/libs/hwui/font/Font.cpp
diff options
context:
space:
mode:
authorDigish Pandya <digishp@codeaurora.org>2014-05-12 14:37:04 +0530
committerDigish Pandya <digishp@codeaurora.org>2014-05-15 08:59:22 +0530
commitc62c1cc17ded117433d23ba5dd6c364b05fbcdbd (patch)
tree77a4ff0a587caaf8dd612dcf6e642a7e5f25bcf4 /libs/hwui/font/Font.cpp
parente3e2c471b2504335e99ed15975c3c5c9dfbf2795 (diff)
downloadframeworks_base-c62c1cc17ded117433d23ba5dd6c364b05fbcdbd.zip
frameworks_base-c62c1cc17ded117433d23ba5dd6c364b05fbcdbd.tar.gz
frameworks_base-c62c1cc17ded117433d23ba5dd6c364b05fbcdbd.tar.bz2
Use alpha channel instead of red in drawCachedGlyphBitmap
the correct value to copy in bitmap is alpha component from the cachebuffer. currently it is offset to red channel if format is RGBA which is wrong. this is followup fix for https://android-review.googlesource.com/#/c/93943/ Change-Id: I96b5ba35df5ccaef44caf2542d35d6585ba1df80 Signed-off-by: Digish Pandya <digishp@codeaurora.org>
Diffstat (limited to 'libs/hwui/font/Font.cpp')
-rw-r--r--libs/hwui/font/Font.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp
index b493298..eb33cf1 100644
--- a/libs/hwui/font/Font.cpp
+++ b/libs/hwui/font/Font.cpp
@@ -215,6 +215,7 @@ void Font::drawCachedGlyphBitmap(CachedGlyphInfo* glyph, int x, int y, uint8_t*
PixelBuffer* pixelBuffer = cacheTexture->getPixelBuffer();
uint32_t formatSize = PixelBuffer::formatSize(pixelBuffer->getFormat());
+ uint32_t alpha_channel_offset = PixelBuffer::formatAlphaOffset(pixelBuffer->getFormat());
uint32_t cacheWidth = cacheTexture->getWidth();
uint32_t srcStride = formatSize * cacheWidth;
uint32_t startY = glyph->mStartY * srcStride;
@@ -229,7 +230,7 @@ void Font::drawCachedGlyphBitmap(CachedGlyphInfo* glyph, int x, int y, uint8_t*
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];
+ bitmap[bitmapY + dstX + i] = cacheBuffer[cacheY + (glyph->mStartX + i)*formatSize + alpha_channel_offset];
}
}
}