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..947c717a06aa173868a8d07399885e7c8a93ad4a 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); |
@@ -459,9 +459,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); |
bungeman-skia
2016/07/11 22:18:42
For the no-skew case everything is the same except
|
+ canvas.translate(face->glyph->bitmap_left, -face->glyph->bitmap_top); |
+ |
SkPaint paint; |
paint.setFilterQuality(kMedium_SkFilterQuality); |
canvas.drawBitmap(unscaledBitmap, 0, 0, &paint); |