aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-11-03 14:00:24 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-03 14:00:24 -0800
commitada68ef2dc986478288a8b8ad867fd3aca431162 (patch)
treece1075aafba9965c65840f2b76c472f6625b4b1b /src/gpu
parenta6ca5a002ee62a1a6b146111cd9bc3f0c4891122 (diff)
Improve quality of distance field rendering
- Update spacing of LODs to get better results scaling up to 256 - Remove unnecessary "bolding" from dftext - Add debug colors for dftext LODs BUG=skia:2933,skia:2935 Review URL: https://codereview.chromium.org/703463002
Diffstat (limited to 'src/gpu')
-rwxr-xr-xsrc/gpu/GrAADistanceFieldPathRenderer.cpp4
-rwxr-xr-xsrc/gpu/GrDistanceFieldTextContext.cpp18
-rwxr-xr-xsrc/gpu/effects/GrDistanceFieldTextureEffect.cpp16
3 files changed, 19 insertions, 19 deletions
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index fdd0f68afe..cb0c892dae 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -37,8 +37,8 @@ static int g_NumFreedPaths = 0;
// mip levels
static const int kSmallMIP = 32;
-static const int kMediumMIP = 64;
-static const int kLargeMIP = 128;
+static const int kMediumMIP = 78;
+static const int kLargeMIP = 192;
////////////////////////////////////////////////////////////////////////////////
GrAADistanceFieldPathRenderer::GrAADistanceFieldPathRenderer(GrContext* context)
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 6ffa3c3cac..5c9019b2b2 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -34,9 +34,9 @@ SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
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;
+static const int kMediumDFFontSize = 78;
+static const int kMediumDFFontLimit = 78;
+static const int kLargeDFFontSize = 192;
namespace {
// position + texture coord
@@ -153,12 +153,24 @@ inline void GrDistanceFieldTextContext::init(const GrPaint& paint, const SkPaint
if (scaledTextSize <= kSmallDFFontLimit) {
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));
+#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));
+#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));
+#endif
}
fUseLCDText = fSkPaint.isLCDRenderText();
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
index e90ebfbf75..b9776986b5 100755
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
@@ -16,16 +16,6 @@
#include "SkDistanceFieldGen.h"
-// To get optical sizes people don't complain about when we blit correctly,
-// we need to slightly bold each glyph. On the Mac, we need a larger bold value.
-#if defined(SK_BUILD_FOR_MAC)
-#define SK_DistanceFieldLCDFactor "0.33"
-#define SK_DistanceFieldNonLCDFactor "0.25"
-#else
-#define SK_DistanceFieldLCDFactor "0.05"
-#define SK_DistanceFieldNonLCDFactor "0.05"
-#endif
-
// Assuming a radius of the diagonal of the fragment, hence a factor of sqrt(2)/2
#define SK_DistanceFieldAAFactor "0.7071"
@@ -66,8 +56,7 @@ public:
kVec2f_GrSLType);
fsBuilder->codeAppend(";\n");
fsBuilder->codeAppend("\tfloat distance = "
- SK_DistanceFieldMultiplier "*(texColor.r - " SK_DistanceFieldThreshold ")"
- "+ " SK_DistanceFieldNonLCDFactor ";\n");
+ SK_DistanceFieldMultiplier "*(texColor.r - " SK_DistanceFieldThreshold ");");
// we adjust for the effect of the transformation on the distance by using
// the length of the gradient of the texture coordinates. We use st coordinates
@@ -465,8 +454,7 @@ public:
fsBuilder->codeAppend("\tdistance.z = texColor.r;\n");
fsBuilder->codeAppend("\tdistance = "
- "vec3(" SK_DistanceFieldMultiplier ")*(distance - vec3(" SK_DistanceFieldThreshold"))"
- "+ vec3(" SK_DistanceFieldLCDFactor ");\n");
+ "vec3(" SK_DistanceFieldMultiplier ")*(distance - vec3(" SK_DistanceFieldThreshold"));");
// we adjust for the effect of the transformation on the distance by using
// the length of the gradient of the texture coordinates. We use st coordinates