diff options
author | Khushal <khushalsagar@chromium.org> | 2018-06-06 17:46:38 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-07 18:03:11 +0000 |
commit | fa8ff09457f82119be0d00b7f37afb790487819e (patch) | |
tree | 65ee0f8eff9997add651bf8f3b48ac74b4413cdf /src/gpu/text/GrGlyphCache.cpp | |
parent | d5b4593024544c3405615066aa5b4f94352eb3cb (diff) |
fonts: Hook up FallbackTextHelper to font remoting.
Use GrContext::FallbackTextHelper in SkTextBlobCacheDiffCanvas to
replicate glyph generation logic for fallback text during analysis. This
ensures that we correctly handle these fallback cases when using
distance field or paths for text rendering.
R=herb@google.com, jvanverth@google.com
Bug: skia:7913
Change-Id: I3067c4f1bd09231a564ac7c4cd89efcb876d2abd
Reviewed-on: https://skia-review.googlesource.com/132285
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Diffstat (limited to 'src/gpu/text/GrGlyphCache.cpp')
-rw-r--r-- | src/gpu/text/GrGlyphCache.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gpu/text/GrGlyphCache.cpp b/src/gpu/text/GrGlyphCache.cpp index b564c93c02..f6a18c3271 100644 --- a/src/gpu/text/GrGlyphCache.cpp +++ b/src/gpu/text/GrGlyphCache.cpp @@ -5,20 +5,17 @@ * found in the LICENSE file. */ +#include "GrGlyphCache.h" #include "GrAtlasManager.h" +#include "GrCaps.h" #include "GrDistanceFieldGenFromVector.h" -#include "GrGlyphCache.h" #include "SkAutoMalloc.h" #include "SkDistanceFieldGen.h" -GrGlyphCache::GrGlyphCache(const GrCaps* caps, float maxTextureBytes) - : fPreserveStrike(nullptr) - , fGlyphSizeLimit(0) { - - int maxDim, minDim, maxPlot, minPlot; - GrAtlasManager::ComputeAtlasLimits(caps, maxTextureBytes, &maxDim, &minDim, &maxPlot, &minPlot); - fGlyphSizeLimit = minPlot; +GrGlyphCache::GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes) + : fPreserveStrike(nullptr), fGlyphSizeLimit(0) { + fGlyphSizeLimit = ComputeGlyphSizeLimit(caps->maxTextureSize(), maxTextureBytes); } GrGlyphCache::~GrGlyphCache() { @@ -40,6 +37,13 @@ void GrGlyphCache::freeAll() { fCache.rewind(); } +SkScalar GrGlyphCache::ComputeGlyphSizeLimit(int maxTextureSize, size_t maxTextureBytes) { + int maxDim, minDim, maxPlot, minPlot; + GrAtlasManager::ComputeAtlasLimits(maxTextureSize, maxTextureBytes, &maxDim, &minDim, &maxPlot, + &minPlot); + return minPlot; +} + void GrGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) { GrGlyphCache* glyphCache = reinterpret_cast<GrGlyphCache*>(ptr); |