Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Unified Diff: src/ports/SkFontHost_FreeType_common.cpp

Issue 2139703002: Rotate emoji with FreeType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Less invasive, update comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkFontHost_FreeType_common.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/ports/SkFontHost_FreeType_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698