aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2018-01-29 15:09:26 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-30 15:08:15 +0000
commitb42610aa9b0e431c5658f7f9ada8553e4f90869c (patch)
treebcf46029ba3f6bbcd19a616a00098654c82d1dfe
parent6a0176bf033c780bb92396220db8140f30948345 (diff)
Reduce the amount of padding needed for SDFs.
SDF glyphs and paths were padded by 4 pixels, and had an inset of 2 pixels within that for rendering the shape. We should be able to use a pad of 1, and the original bounds for the shape. This allows us to increase the maximum size in the atlas. Bug: skia: Change-Id: I844d6afc4e0a52fc49fe1f6df94b635779290307 Reviewed-on: https://skia-review.googlesource.com/101440 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
-rw-r--r--src/core/SkDistanceFieldGen.h9
-rw-r--r--src/gpu/ops/GrSmallPathRenderer.cpp2
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp6
3 files changed, 8 insertions, 9 deletions
diff --git a/src/core/SkDistanceFieldGen.h b/src/core/SkDistanceFieldGen.h
index 5e7af52a54..5bc68b9d68 100644
--- a/src/core/SkDistanceFieldGen.h
+++ b/src/core/SkDistanceFieldGen.h
@@ -12,11 +12,10 @@
// the max magnitude for the distance field
// distance values are limited to the range (-SK_DistanceFieldMagnitude, SK_DistanceFieldMagnitude]
#define SK_DistanceFieldMagnitude 4
-// we need to pad around the original glyph to allow our maximum distance of
-// SK_DistanceFieldMagnitude texels away from any edge
-#define SK_DistanceFieldPad 4
-// the rect we render with is inset from the distance field glyph size to allow for bilerp
-#define SK_DistanceFieldInset 2
+// we need to pad around the original glyph to allow for bilerp sampling
+#define SK_DistanceFieldPad 1
+// the rect we render with is inset from the SDF size
+#define SK_DistanceFieldInset 1
// For the fragment shader:
// The distance field is constructed as unsigned char values,
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index 3e7da52230..96317604f2 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -37,7 +37,7 @@ static int g_NumFreedShapes = 0;
// mip levels
static const SkScalar kIdealMinMIP = 12;
-static const SkScalar kMaxMIP = 162;
+static const SkScalar kMaxMIP = 168;
static const SkScalar kMaxDim = 73;
static const SkScalar kMinSize = SK_ScalarHalf;
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 1dce4e0d44..a404eed5cd 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -23,9 +23,9 @@
// which we switch over to drawing as paths as controlled by Options.
static const int kSmallDFFontSize = 32;
static const int kSmallDFFontLimit = 32;
-static const int kMediumDFFontSize = 72;
-static const int kMediumDFFontLimit = 72;
-static const int kLargeDFFontSize = 162;
+static const int kMediumDFFontSize = 75;
+static const int kMediumDFFontLimit = 75;
+static const int kLargeDFFontSize = 168;
static const int kDefaultMinDistanceFieldFontSize = 18;
#ifdef SK_BUILD_FOR_ANDROID