diff options
author | agl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-11 17:22:38 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-11 17:22:38 +0000 |
commit | 558434a9e129904595cf5161097b843c681a05c7 (patch) | |
tree | e359b30bdfc5fd2501424715856cb5b18a9514b5 /src/ports | |
parent | 4484d23ab47d4b0941ba6931e5d4edb891f073d2 (diff) |
FreeType: fix garbled bitmap glyphs.
At some point (probably in one of the LCD patches), the fMaskFormat
for bitmap glyphs changed from kA8 to kBW. Formerly, bitmap glyphs
were always transformed into A8 format. With this patch, we check the
fMaskFormat and pick the correct transform at run time.
http://code.google.com/p/chromium/issues/detail?id=18531
http://codereview.appspot.com/104071
git-svn-id: http://skia.googlecode.com/svn/trunk@313 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index e09e542819..c7e310e4ce 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -693,7 +693,9 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) { const uint8_t* src = (const uint8_t*)fFace->glyph->bitmap.buffer; uint8_t* dst = (uint8_t*)glyph.fImage; - if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY) { + if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY || + (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO && + glyph.fMaskFormat == SkMask::kBW_Format)) { unsigned srcRowBytes = fFace->glyph->bitmap.pitch; unsigned dstRowBytes = glyph.rowBytes(); unsigned minRowBytes = SkMin32(srcRowBytes, dstRowBytes); @@ -705,7 +707,8 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) { src += srcRowBytes; dst += dstRowBytes; } - } else if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO) { + } else if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO && + glyph.fMaskFormat == SkMask::kA8_Format) { for (int y = 0; y < fFace->glyph->bitmap.rows; ++y) { uint8_t byte = 0; int bits = 0; @@ -726,6 +729,8 @@ void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) { src += fFace->glyph->bitmap.pitch; dst += glyph.rowBytes(); } + } else { + SkASSERT(!"unknown glyph bitmap transform needed"); } if (lcdRenderMode) |