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

Unified Diff: src/gpu/GrDistanceFieldTextContext.cpp

Issue 218613014: Add support for multiple base distance field sizes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix issues Created 6 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDistanceFieldTextContext.cpp
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 638ec597074bbef9010c3faaea188000af41c4e1..71e5d0f16c7b5294252c70825b52e74d578cfa43 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 @@ inline void GrDistanceFieldTextContext::init(const GrPaint& paint, const SkPaint
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698