aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-08-14 11:21:14 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-14 17:39:04 +0000
commitddfd2a66273047273a81ca7f4348085ceb6e6e80 (patch)
tree64d9ab9c233337c51fa436e71203207880702779 /src
parent17e33cc7b0297cc567e419ea33be5707b9181c85 (diff)
Use kLow_SkFilterQuality in generateGlyphImage
This reduces jank when flinging a page of emoji on Android (I have separately shared out a spreadsheet). Arguably, the quality loss should be acceptable since we shouldn't be down-scaling that much (magnitude-wise not frequency-wise). Ideally, we would add a raster mode where we would draw at the correct size w/o generating the mip maps. Change-Id: Id91d638db1b2457567e54c264ed3fa5d10316976 Reviewed-on: https://skia-review.googlesource.com/33763 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/ports/SkFontHost_FreeType_common.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index a216fdb29c..864f75dee8 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -585,7 +585,15 @@ void SkScalerContext_FreeType_Base::generateGlyphImage(
canvas.translate(face->glyph->bitmap_left, -face->glyph->bitmap_top);
SkPaint paint;
- paint.setFilterQuality(kMedium_SkFilterQuality);
+ // Using kMedium FilterQuality will cause mipmaps to be generated. Use
+ // kLow when the results will be roughly the same in order to avoid
+ // the mipmap generation cost.
+ // See skbug.com/6967
+ if (bitmapTransform.getMinScale() < 0.5) {
+ paint.setFilterQuality(kMedium_SkFilterQuality);
+ } else {
+ paint.setFilterQuality(kLow_SkFilterQuality);
+ }
canvas.drawBitmap(unscaledBitmap, 0, 0, &paint);
// If the destination is BW or LCD, convert from A8.