aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRemoteGlyphCache.h
diff options
context:
space:
mode:
authorGravatar Khushal <khushalsagar@chromium.org>2018-05-17 10:41:40 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-17 20:50:43 +0000
commit51371a43397424ee4d3057fd5a82ec7c01eff705 (patch)
tree0ae5f93ab2ee57ddb73a3ed32633b9774c1d00c7 /src/core/SkRemoteGlyphCache.h
parente6c0fe0b8fb4fb66b0c8d3b3abac6257c3201f00 (diff)
fonts: Handle fallback to using paths for text rendering for remoting.
SkRemoteGlyphCache only sends images for glyphs, even for cases where the gpu falls back to drawing text as paths. This includes cases in SkDraw::ShouldDrawTextAsPaths and when the glyph exceeds the max bounds that can fit on the atlas. Fix this by identifying these cases in the renderer and sending paths instead. Note: We still don't handle distance field text correctly. R=herb@google.com, bsalomon@google.com Bug: skia:7913 Change-Id: I17d4eccbeaa2e995ae67b61c76cebd27f8280329 Reviewed-on: https://skia-review.googlesource.com/128203 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.h')
-rw-r--r--src/core/SkRemoteGlyphCache.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/core/SkRemoteGlyphCache.h b/src/core/SkRemoteGlyphCache.h
index 36fe59306b..60d880791f 100644
--- a/src/core/SkRemoteGlyphCache.h
+++ b/src/core/SkRemoteGlyphCache.h
@@ -69,6 +69,7 @@ private:
void processGlyphRun(const SkPoint& position,
const SkTextBlobRunIterator& it,
const SkPaint& runPaint);
+ void processGlyphRunForPaths(const SkTextBlobRunIterator& it, const SkPaint& runPaint);
const SkMatrix fDeviceMatrix;
const SkSurfaceProps fSurfaceProps;
@@ -122,9 +123,11 @@ public:
SkDiscardableHandleId discardableHandleId);
~SkGlyphCacheState();
- void addGlyph(SkTypeface*, const SkScalerContextEffects&, SkPackedGlyphID);
+ void addGlyph(SkTypeface*, const SkScalerContextEffects&, SkPackedGlyphID, bool pathOnly);
void writePendingGlyphs(Serializer* serializer);
- bool has_pending_glyphs() const { return !fPendingGlyphs.empty(); }
+ bool has_pending_glyphs() const {
+ return !fPendingGlyphImages.empty() || !fPendingGlyphPaths.empty();
+ }
SkDiscardableHandleId discardable_handle_id() const { return fDiscardableHandleId; }
const SkDescriptor& getDeviceDescriptor() {
return *fDeviceDescriptor;
@@ -135,12 +138,16 @@ public:
}
private:
+ void writeGlyphPath(const SkPackedGlyphID& glyphID, Serializer* serializer) const;
+
// The set of glyphs cached on the remote client.
- SkTHashSet<SkPackedGlyphID> fCachedGlyphs;
+ SkTHashSet<SkPackedGlyphID> fCachedGlyphImages;
+ SkTHashSet<SkPackedGlyphID> fCachedGlyphPaths;
// The set of glyphs which has not yet been serialized and sent to the
// remote client.
- std::vector<SkPackedGlyphID> fPendingGlyphs;
+ std::vector<SkPackedGlyphID> fPendingGlyphImages;
+ std::vector<SkPackedGlyphID> fPendingGlyphPaths;
// The device descriptor is used to create the scaler context. The glyphs to have the
// correct device rendering. The key descriptor is used for communication. The GPU side will
@@ -153,8 +160,9 @@ public:
std::unique_ptr<SkScalerContext> fContext;
};
- SkGlyphCacheState* getOrCreateCache(
- SkTypeface*, std::unique_ptr<SkDescriptor>, std::unique_ptr<SkDescriptor>);
+ SkGlyphCacheState* getOrCreateCache(const SkPaint&, const SkSurfaceProps*, const SkMatrix*,
+ SkScalerContextRec* deviceRec,
+ SkScalerContextEffects* effects);
private:
SkDescriptorMap<std::unique_ptr<SkGlyphCacheState>> fRemoteGlyphStateMap;