diff options
author | Jim Van Verth <jvanverth@google.com> | 2018-01-30 14:30:35 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-30 20:08:45 +0000 |
commit | 10105308dc86dccd3d4a0c8b9863d7c749440b21 (patch) | |
tree | 12865f3f80d2da18ab5613b016a5d10ac91cc050 /src/core/SkDistanceFieldGen.h | |
parent | 537d9c0229b296a1b19f678432011d748d73cf18 (diff) |
Reduce the amount of padding needed for SDFs, take 2
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 2, and outset the original bounds by one texel. This allows us
to increase the maximum size in the atlas.
Change-Id: I06b229c7a3bc907d75d320461320d0b588f9a77c
Reviewed-on: https://skia-review.googlesource.com/101843
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/core/SkDistanceFieldGen.h')
-rw-r--r-- | src/core/SkDistanceFieldGen.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/SkDistanceFieldGen.h b/src/core/SkDistanceFieldGen.h index 5e7af52a54..16ed00ab5a 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 2 +// 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, |