Add support for multiple base distance field sizes.
This improves quality at higher point sizes.
BUG=skia:2173
R=robertphillips@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/218613014
git-svn-id: http://skia.googlecode.com/svn/trunk@14030 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 638ec59..71e5d0f 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -23,7 +23,11 @@
static const int kGlyphCoordsAttributeIndex = 1;
-static const int kBaseDFFontSize = 32;
+static const int kSmallDFFontSize = 32;
+static const int kSmallDFFontLimit = 32;
+static const int kMediumDFFontSize = 64;
+static const int kMediumDFFontLimit = 64;
+static const int kLargeDFFontSize = 128;
SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
"Dump the contents of the font cache before every purge.");
@@ -303,9 +307,17 @@
fVertices = NULL;
fMaxVertices = 0;
- fTextRatio = fSkPaint.getTextSize()/kBaseDFFontSize;
+ if (fSkPaint.getTextSize() <= kSmallDFFontLimit) {
+ fTextRatio = fSkPaint.getTextSize()/kSmallDFFontSize;
+ fSkPaint.setTextSize(SkIntToScalar(kSmallDFFontSize));
+ } else if (fSkPaint.getTextSize() <= kMediumDFFontLimit) {
+ fTextRatio = fSkPaint.getTextSize()/kMediumDFFontSize;
+ fSkPaint.setTextSize(SkIntToScalar(kMediumDFFontSize));
+ } else {
+ fTextRatio = fSkPaint.getTextSize()/kLargeDFFontSize;
+ fSkPaint.setTextSize(SkIntToScalar(kLargeDFFontSize));
+ }
- fSkPaint.setTextSize(SkIntToScalar(kBaseDFFontSize));
fSkPaint.setLCDRenderText(false);
fSkPaint.setAutohinted(false);
fSkPaint.setSubpixelText(true);