| Index: src/ports/SkFontHost_FreeType_common.cpp
|
| diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
|
| index 245ded1283572362da007c6837caf4e9d9486e0a..96a7134fd838f04239ef4d3b0abf523c5da20c77 100644
|
| --- a/src/ports/SkFontHost_FreeType_common.cpp
|
| +++ b/src/ports/SkFontHost_FreeType_common.cpp
|
| @@ -334,7 +334,11 @@ inline SkColorType SkColorType_for_SkMaskFormat(SkMask::Format format) {
|
| }
|
| }
|
|
|
| -void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGlyph& glyph) {
|
| +void SkScalerContext_FreeType_Base::generateGlyphImage(
|
| + FT_Face face,
|
| + const SkGlyph& glyph,
|
| + const SkMatrix& bitmapTransform)
|
| +{
|
| const bool doBGR = SkToBool(fRec.fFlags & SkScalerContext::kLCD_BGROrder_Flag);
|
| const bool doVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag);
|
|
|
| @@ -411,11 +415,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly
|
| }
|
|
|
| // If no scaling needed, directly copy glyph bitmap.
|
| - if (glyph.fWidth == face->glyph->bitmap.width &&
|
| - glyph.fHeight == face->glyph->bitmap.rows &&
|
| - glyph.fTop == -face->glyph->bitmap_top &&
|
| - glyph.fLeft == face->glyph->bitmap_left)
|
| - {
|
| + if (bitmapTransform.isIdentity()) {
|
| SkMask dstMask;
|
| glyph.toMask(&dstMask);
|
| copyFTBitmap(face->glyph->bitmap, dstMask);
|
| @@ -426,6 +426,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly
|
|
|
| // Copy the FT_Bitmap into an SkBitmap (either A8 or ARGB)
|
| SkBitmap unscaledBitmap;
|
| + // TODO: mark this as sRGB when the blits will be sRGB.
|
| unscaledBitmap.allocPixels(SkImageInfo::Make(face->glyph->bitmap.width,
|
| face->glyph->bitmap.rows,
|
| SkColorType_for_FTPixelMode(pixel_mode),
|
| @@ -447,6 +448,7 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly
|
| bitmapRowBytes = glyph.rowBytes();
|
| }
|
| SkBitmap dstBitmap;
|
| + // TODO: mark this as sRGB when the blits will be sRGB.
|
| dstBitmap.setInfo(SkImageInfo::Make(glyph.fWidth, glyph.fHeight,
|
| SkColorType_for_SkMaskFormat(maskFormat),
|
| kPremul_SkAlphaType),
|
| @@ -459,9 +461,15 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGly
|
|
|
| // Scale unscaledBitmap into dstBitmap.
|
| SkCanvas canvas(dstBitmap);
|
| +#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
|
| + canvas.clear(0x33FF0000);
|
| +#else
|
| canvas.clear(SK_ColorTRANSPARENT);
|
| - canvas.scale(SkIntToScalar(glyph.fWidth) / SkIntToScalar(face->glyph->bitmap.width),
|
| - SkIntToScalar(glyph.fHeight) / SkIntToScalar(face->glyph->bitmap.rows));
|
| +#endif
|
| + canvas.translate(-glyph.fLeft, -glyph.fTop);
|
| + canvas.concat(bitmapTransform);
|
| + canvas.translate(face->glyph->bitmap_left, -face->glyph->bitmap_top);
|
| +
|
| SkPaint paint;
|
| paint.setFilterQuality(kMedium_SkFilterQuality);
|
| canvas.drawBitmap(unscaledBitmap, 0, 0, &paint);
|
|
|