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/core/SkRemoteGlyphCache.h | |
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/core/SkRemoteGlyphCache.h')
-rw-r--r-- | src/core/SkRemoteGlyphCache.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/core/SkRemoteGlyphCache.h b/src/core/SkRemoteGlyphCache.h index 4fa4e0afc1..2772de67cb 100644 --- a/src/core/SkRemoteGlyphCache.h +++ b/src/core/SkRemoteGlyphCache.h @@ -59,6 +59,8 @@ public: bool fContextSupportsDistanceFieldText = true; SkScalar fMinDistanceFieldFontSize = -1.f; SkScalar fMaxDistanceFieldFontSize = -1.f; + int fMaxTextureSize = 0; + size_t fMaxTextureBytes = 0u; }; SkTextBlobCacheDiffCanvas(int width, int height, const SkMatrix& deviceMatrix, const SkSurfaceProps& props, SkStrikeServer* strikeserver, @@ -79,9 +81,12 @@ private: void processGlyphRun(const SkPoint& position, const SkTextBlobRunIterator& it, const SkPaint& runPaint); - void processGlyphRunForPaths(const SkTextBlobRunIterator& it, const SkPaint& runPaint); - void processGlyphRunForDFT(const SkTextBlobRunIterator& it, const SkPaint& runPaint, - SkScalerContextFlags flags); + void processGlyphRunForPaths(const SkTextBlobRunIterator& it, const SkPaint& runPaint, + const SkMatrix& runMatrix); +#if SK_SUPPORT_GPU + bool processGlyphRunForDFT(const SkTextBlobRunIterator& it, const SkPaint& runPaint, + const SkMatrix& runMatrix); +#endif const SkSurfaceProps& surfaceProps() const; const SkMatrix fDeviceMatrix; @@ -138,10 +143,7 @@ public: void addGlyph(SkTypeface*, const SkScalerContextEffects&, SkPackedGlyphID, bool pathOnly); void writePendingGlyphs(Serializer* serializer); - bool has_pending_glyphs() const { - return !fPendingGlyphImages.empty() || !fPendingGlyphPaths.empty(); - } - SkDiscardableHandleId discardable_handle_id() const { return fDiscardableHandleId; } + SkDiscardableHandleId discardableHandleId() const { return fDiscardableHandleId; } const SkDescriptor& getDeviceDescriptor() { return *fDeviceDescriptor; } @@ -149,8 +151,12 @@ public: const SkDescriptor& getKeyDescriptor() { return *fKeyDescriptor; } + const SkGlyph& findGlyph(SkTypeface*, const SkScalerContextEffects&, SkPackedGlyphID); private: + bool hasPendingGlyphs() const { + return !fPendingGlyphImages.empty() || !fPendingGlyphPaths.empty(); + } void writeGlyphPath(const SkPackedGlyphID& glyphID, Serializer* serializer) const; // The set of glyphs cached on the remote client. @@ -171,6 +177,9 @@ public: // The context built using fDeviceDescriptor std::unique_ptr<SkScalerContext> fContext; + // FallbackTextHelper cases require glyph metrics when analyzing a glyph run, in which case + // we cache them here. + SkTHashMap<SkPackedGlyphID, SkGlyph> fGlyphMap; }; SkGlyphCacheState* getOrCreateCache(const SkPaint&, const SkSurfaceProps*, const SkMatrix*, @@ -206,7 +215,7 @@ public: // successful, subsequent attempts to delete the same handle are invalid. virtual bool deleteHandle(SkDiscardableHandleId) = 0; - virtual void NotifyCacheMiss(CacheMissType) {} + virtual void notifyCacheMiss(CacheMissType) {} }; SkStrikeClient(sk_sp<DiscardableHandleManager>, bool isLogging = true); |