aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Bruce Wang <brucewang@google.com>2018-07-18 12:36:56 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-31 02:23:49 +0000
commit0bf5408286ea3dacb197c220e1033dea3eeef2a8 (patch)
treec58df7fc95d84ec7e90ac825d1d64fbb0631dce5 /src
parent946a162a5239d41b498e1658ca705db1b371ce73 (diff)
Implement Subpixel mode for color format image.
Change-Id: I4b76b1def8458fec3c5d94fa8c4e1dd48c74e376 Reviewed-on: https://skia-review.googlesource.com/142165 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkScalerContext_win_dw.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 8f9a761614..dac3c827c1 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -594,7 +594,14 @@ void SkScalerContext_DW::generateColorMetrics(SkGlyph* glyph) {
}
bounds.join(path.getBounds());
}
- HRV(fSkXform.mapRect(&bounds));
+ SkMatrix matrix = fSkXform;
+#ifndef SK_IGNORE_EMOJI_SUBPIXEL_FIX
+ if (this->isSubpixel()) {
+ matrix.postTranslate(SkFixedToScalar(glyph->getSubXFixed()),
+ SkFixedToScalar(glyph->getSubYFixed()));
+ }
+#endif
+ matrix.mapRect(&bounds);
// Round float bound values into integer.
SkIRect ibounds = bounds.roundOut();
@@ -980,6 +987,12 @@ void SkScalerContext_DW::generateColorGlyphImage(const SkGlyph& glyph) {
SkMatrix matrix = fSkXform;
matrix.postTranslate(-SkIntToScalar(glyph.fLeft), -SkIntToScalar(glyph.fTop));
+#ifndef SK_IGNORE_EMOJI_SUBPIXEL_FIX
+ if (this->isSubpixel()) {
+ matrix.postTranslate(SkFixedToScalar(glyph.getSubXFixed()),
+ SkFixedToScalar(glyph.getSubYFixed()));
+ }
+#endif
SkRasterClip rc(SkIRect::MakeWH(glyph.fWidth, glyph.fHeight));
SkDraw draw;
draw.fDst = SkPixmap(SkImageInfo::MakeN32(glyph.fWidth, glyph.fHeight, kPremul_SkAlphaType),