aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2015-03-19 11:34:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-19 11:34:13 -0700
commit24ba00825092be0d400074e0121ffc7221950dd9 (patch)
tree9bbf152b6c834f77588735d61ddd06c856b494f3 /src
parent5d09568a0c67bc54dfb38552d0136b06d3ebf018 (diff)
Add minimum size for using distance fields.
Since we're not scaling down as far, we can increase the base sizes a little. Also darken debug text colors to get better value comparison with black. BUG=skia:3541 Review URL: https://codereview.chromium.org/1001183003
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gpu/GrDistanceFieldTextContext.cpp24
-rwxr-xr-xsrc/gpu/effects/GrDistanceFieldTextureEffect.cpp2
2 files changed, 14 insertions, 12 deletions
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 180c506e33..7e93892a68 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -32,10 +32,11 @@
SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
"Dump the contents of the font cache before every purge.");
-static const int kSmallDFFontSize = 32;
-static const int kSmallDFFontLimit = 32;
-static const int kMediumDFFontSize = 72;
-static const int kMediumDFFontLimit = 72;
+static const int kMinDFFontSize = 18;
+static const int kSmallDFFontSize = 40;
+static const int kSmallDFFontLimit = 40;
+static const int kMediumDFFontSize = 81;
+static const int kMediumDFFontLimit = 81;
static const int kLargeDFFontSize = 162;
static const int kVerticesPerGlyph = 4;
@@ -88,8 +89,9 @@ bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v
SkScalar maxScale = viewMatrix.getMaxScale();
SkScalar scaledTextSize = maxScale*paint.getTextSize();
+ // Hinted text looks far better at small resolutions
// Scaling up beyond 2x yields undesireable artifacts
- if (scaledTextSize > 2*kLargeDFFontSize) {
+ if (scaledTextSize < kMinDFFontSize || scaledTextSize > 2*kLargeDFFontSize) {
return false;
}
@@ -142,22 +144,22 @@ inline void GrDistanceFieldTextContext::init(GrRenderTarget* rt, const GrClip& c
fTextRatio = textSize / kSmallDFFontSize;
fSkPaint.setTextSize(SkIntToScalar(kSmallDFFontSize));
#if DEBUG_TEXT_SIZE
- fSkPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0x00, 0xFF));
- fPaint.setColor(GrColorPackRGBA(0x00, 0x00, 0xFF, 0xFF));
+ fSkPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0x00, 0x7F));
+ fPaint.setColor(GrColorPackRGBA(0x00, 0x00, 0x7F, 0xFF));
#endif
} else if (scaledTextSize <= kMediumDFFontLimit) {
fTextRatio = textSize / kMediumDFFontSize;
fSkPaint.setTextSize(SkIntToScalar(kMediumDFFontSize));
#if DEBUG_TEXT_SIZE
- fSkPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00));
- fPaint.setColor(GrColorPackRGBA(0x00, 0xFF, 0x00, 0xFF));
+ fSkPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0x3F, 0x00));
+ fPaint.setColor(GrColorPackRGBA(0x00, 0x3F, 0x00, 0xFF));
#endif
} else {
fTextRatio = textSize / kLargeDFFontSize;
fSkPaint.setTextSize(SkIntToScalar(kLargeDFFontSize));
#if DEBUG_TEXT_SIZE
- fSkPaint.setColor(SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00));
- fPaint.setColor(GrColorPackRGBA(0xFF, 0x00, 0x00, 0xFF));
+ fSkPaint.setColor(SkColorSetARGB(0xFF, 0x7F, 0x00, 0x00));
+ fPaint.setColor(GrColorPackRGBA(0x7F, 0x00, 0x00, 0xFF));
#endif
}
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
index fc7fe54501..2309edf064 100755
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
@@ -17,7 +17,7 @@
#include "gl/builders/GrGLProgramBuilder.h"
// Assuming a radius of the diagonal of the fragment, hence a factor of sqrt(2)/2
-#define SK_DistanceFieldAAFactor "0.7071"
+#define SK_DistanceFieldAAFactor "0.65"
struct DistanceFieldBatchTracker {
GrGPInput fInputColorType;