Snap non-scaled emoji to pixel borders
Bug: skia:7747
Change-Id: I9a083c2e98a58a847b8f0a37503a09fd94b6ae08
Reviewed-on: https://skia-review.googlesource.com/117184
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 0179e43..8f6cba0 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -886,7 +886,6 @@
skPaint.isDevKernText(), true);
SkColor textColor = paint.filteredPremulColor();
SkScalar textRatio = SK_Scalar1;
- fViewMatrix.mapPoints(fFallbackPos.begin(), fFallbackPos.count());
if (fUseScaledFallback) {
// Set up paint and matrix to scale glyphs
SkPaint scaledPaint(skPaint);
@@ -910,6 +909,11 @@
SkPoint* glyphPos = fFallbackPos.begin();
while (text < stop) {
const SkGlyph& glyph = glyphCacheProc(cache.get(), &text);
+ fViewMatrix.mapPoints(glyphPos, 1);
+ if (!fUseScaledFallback) {
+ glyphPos->fX = SkScalarFloorToScalar(glyphPos->fX);
+ glyphPos->fY = SkScalarFloorToScalar(glyphPos->fY);
+ }
GrAtlasTextContext::BmpAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph,
glyphPos->fX, glyphPos->fY, textColor,
cache.get(), textRatio);