diff options
author | Brian Salomon <bsalomon@google.com> | 2017-12-13 10:59:33 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-20 14:00:44 +0000 |
commit | b5086961f335d6757a88ce7507c445485aaba2e6 (patch) | |
tree | a635252858428f4f0f04144d532cc4ab96388d95 /src/gpu/text | |
parent | e1367b4a064737cbcf78f2297fa89e0a032b2060 (diff) |
Add matrix stack to SkAtlasTextTarget.
Makes SkAtlasTextRenderer::SDFVertex now has a 3 component position vector.
Change-Id: I7ec1a8068fb84388a82e1748d6e9d02820d55abd
Reviewed-on: https://skia-review.googlesource.com/84202
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r-- | src/gpu/text/GrAtlasTextContext.cpp | 4 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextContext.h | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 3faa0f7b87..73a27100d3 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -39,6 +39,7 @@ GrAtlasTextContext::GrAtlasTextContext(const Options& options) fMinDistanceFieldFontSize = options.fMinDistanceFieldFontSize < 0.f ? kDefaultMinDistanceFieldFontSize : options.fMinDistanceFieldFontSize; + fDistanceFieldVerticesAlwaysHaveW = options.fDistanceFieldVerticesAlwaysHaveW; } std::unique_ptr<GrAtlasTextContext> GrAtlasTextContext::Make(const Options& options) { @@ -646,7 +647,8 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, SkTDArray<char> fallbackTxt; SkTDArray<SkScalar> fallbackPos; - bool hasWCoord = viewMatrix.hasPerspective(); + bool hasWCoord = viewMatrix.hasPerspective() || fDistanceFieldVerticesAlwaysHaveW; + // Setup distance field paint and text ratio SkScalar textRatio; SkPaint dfPaint(paint); diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h index 8db0d7e050..52c8dfcb87 100644 --- a/src/gpu/text/GrAtlasTextContext.h +++ b/src/gpu/text/GrAtlasTextContext.h @@ -38,6 +38,8 @@ public: * be rendered from outline as individual paths. Negative means use a default value. */ SkScalar fMaxDistanceFieldFontSize = -1.f; + /** Forces all distance field vertices to use 3 components, not just when in perspective. */ + bool fDistanceFieldVerticesAlwaysHaveW = false; }; static std::unique_ptr<GrAtlasTextContext> Make(const Options& options); @@ -142,6 +144,7 @@ private: SkScalar fMinDistanceFieldFontSize; SkScalar fMaxDistanceFieldFontSize; + bool fDistanceFieldVerticesAlwaysHaveW; #if GR_TEST_UTILS static const uint32_t kTextBlobOpScalerContextFlags = |