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

Unified Diff: src/ports/SkFontHost_FreeType_common.cpp

Issue 2149253005: Revert of Rotate emoji with FreeType. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 96a7134fd838f04239ef4d3b0abf523c5da20c77..245ded1283572362da007c6837caf4e9d9486e0a 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -334,11 +334,7 @@
}
}
-void SkScalerContext_FreeType_Base::generateGlyphImage(
- FT_Face face,
- const SkGlyph& glyph,
- const SkMatrix& bitmapTransform)
-{
+void SkScalerContext_FreeType_Base::generateGlyphImage(FT_Face face, const SkGlyph& glyph) {
const bool doBGR = SkToBool(fRec.fFlags & SkScalerContext::kLCD_BGROrder_Flag);
const bool doVert = SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag);
@@ -415,7 +411,11 @@
}
// If no scaling needed, directly copy glyph bitmap.
- if (bitmapTransform.isIdentity()) {
+ 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)
+ {
SkMask dstMask;
glyph.toMask(&dstMask);
copyFTBitmap(face->glyph->bitmap, dstMask);
@@ -426,7 +426,6 @@
// 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),
@@ -448,7 +447,6 @@
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),
@@ -461,15 +459,9 @@
// Scale unscaledBitmap into dstBitmap.
SkCanvas canvas(dstBitmap);
-#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
- canvas.clear(0x33FF0000);
-#else
canvas.clear(SK_ColorTRANSPARENT);
-#endif
- canvas.translate(-glyph.fLeft, -glyph.fTop);
- canvas.concat(bitmapTransform);
- canvas.translate(face->glyph->bitmap_left, -face->glyph->bitmap_top);
-
+ canvas.scale(SkIntToScalar(glyph.fWidth) / SkIntToScalar(face->glyph->bitmap.width),
+ SkIntToScalar(glyph.fHeight) / SkIntToScalar(face->glyph->bitmap.rows));
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