diff options
| author | 2010-08-27 11:31:50 -0700 | |
|---|---|---|
| committer | 2010-08-27 11:31:50 -0700 | |
| commit | 3750f64dcee8003db77b05a4bc52f50b82c3a1e3 (patch) | |
| tree | 18fe2fbc418dba6e9e35a5378b41b657dc324df3 /libs/hwui/FontRenderer.cpp | |
| parent | d970432538667f4ff0dbd94940a722c813988a8b (diff) | |
| parent | b45c0c9774bd19a9dbe77d149abae4e124b08bf6 (diff) | |
Merge "Apply gamma correction to font rendering."
Diffstat (limited to 'libs/hwui/FontRenderer.cpp')
| -rw-r--r-- | libs/hwui/FontRenderer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index ccc92ebdfe18..5d7f8bfc0635 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -101,8 +101,8 @@ void Font::drawCachedGlyph(CachedGlyphInfo* glyph, int x, int y) { nPenX, nPenY - height, 0, u1, v1); } -void Font::drawCachedGlyph(CachedGlyphInfo *glyph, int x, int y, - uint8_t *bitmap, uint32_t bitmapW, uint32_t bitmapH) { +void Font::drawCachedGlyph(CachedGlyphInfo* glyph, int x, int y, + uint8_t* bitmap, uint32_t bitmapW, uint32_t bitmapH) { int nPenX = x + glyph->mBitmapLeft; int nPenY = y + glyph->mBitmapTop; @@ -116,7 +116,7 @@ void Font::drawCachedGlyph(CachedGlyphInfo *glyph, int x, int y, int32_t bX = 0, bY = 0; for (cacheX = glyph->mStartX, bX = nPenX; cacheX < endX; cacheX++, bX++) { for (cacheY = glyph->mStartY, bY = nPenY; cacheY < endY; cacheY++, bY++) { - if (bX < 0 || bY < 0 || bX >= (int32_t)bitmapW || bY >= (int32_t)bitmapH) { + if (bX < 0 || bY < 0 || bX >= (int32_t) bitmapW || bY >= (int32_t) bitmapH) { LOGE("Skipping invalid index"); continue; } @@ -286,6 +286,7 @@ Font* Font::create(FontRenderer* state, uint32_t fontId, float fontSize) { FontRenderer::FontRenderer() { LOGD("Creating FontRenderer"); + mGammaTable = NULL; mInitialized = false; mMaxNumberOfQuads = 1024; mCurrentQuadIndex = 0; @@ -405,7 +406,7 @@ bool FontRenderer::cacheBitmap(const SkGlyph& glyph, uint32_t* retOriginX, uint3 for (cacheX = startX, bX = 0; cacheX < endX; cacheX++, bX++) { for (cacheY = startY, bY = 0; cacheY < endY; cacheY++, bY++) { uint8_t tempCol = bitmapBuffer[bY * stride + bX]; - cacheBuffer[cacheY * cacheWidth + cacheX] = tempCol; + cacheBuffer[cacheY * cacheWidth + cacheX] = mGammaTable[tempCol]; } } |