diff options
author | 2018-03-21 10:30:47 -0400 | |
---|---|---|
committer | 2018-03-21 15:44:28 +0000 | |
commit | 0262ea03f81c484ed4c287da55f1e0f2e65363b5 (patch) | |
tree | 4c07d84b912c1cb36d018f8db469803e695f0182 /src | |
parent | 4e34a017231ca164fd25f8f909a3880d23a0d0fc (diff) |
Try to have glyph count go through to allow easier glyphid sets
Change-Id: I402e7240629db58c4212049583d6a06bcf7dcc40
Reviewed-on: https://skia-review.googlesource.com/115606
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkRemoteGlyphCache.cpp | 15 | ||||
-rw-r--r-- | src/core/SkTypeface_remote.h | 8 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp index da3a64c894..4aa25128cf 100644 --- a/src/core/SkRemoteGlyphCache.cpp +++ b/src/core/SkRemoteGlyphCache.cpp @@ -9,9 +9,10 @@ struct WireTypeface { // std::thread::id thread_id; // TODO:need to figure a good solution - SkFontID typeface_id; + SkFontID typefaceID; + int glyphCount; SkFontStyle style; - bool is_fixed; + bool isFixed; }; void SkRemoteGlyphCacheRenderer::prepareSerializeProcs(SkSerialProcs* procs) { @@ -47,6 +48,7 @@ SkScalerContext* SkRemoteGlyphCacheRenderer::generateScalerContext( sk_sp<SkData> SkRemoteGlyphCacheRenderer::encodeTypeface(SkTypeface* tf) { WireTypeface wire = { SkTypeface::UniqueID(tf), + tf->countGlyphs(), tf->fontStyle(), tf->isFixedPitch() }; @@ -84,16 +86,17 @@ sk_sp<SkTypeface> SkRemoteGlyphCacheGPU::decodeTypeface(const void* buf, size_t } memcpy(&wire, buf, sizeof(wire)); - auto typeFace = fMapIdToTypeface.find(wire.typeface_id); + auto typeFace = fMapIdToTypeface.find(wire.typefaceID); if (typeFace == nullptr) { auto newTypeface = sk_make_sp<SkTypefaceProxy>( - wire.typeface_id, + wire.typefaceID, + wire.glyphCount, wire.style, - wire.is_fixed, + wire.isFixed, fRemoteScalerContext.get()); - typeFace = fMapIdToTypeface.set(wire.typeface_id, newTypeface); + typeFace = fMapIdToTypeface.set(wire.typefaceID, newTypeface); } return *typeFace; } diff --git a/src/core/SkTypeface_remote.h b/src/core/SkTypeface_remote.h index 03516be481..af90367d26 100644 --- a/src/core/SkTypeface_remote.h +++ b/src/core/SkTypeface_remote.h @@ -77,16 +77,19 @@ class SkTypefaceProxy : public SkTypeface { public: SkTypefaceProxy( SkFontID fontId, + int glyphCount, const SkFontStyle& style, bool isFixed, SkRemoteScalerContext* rsc) : INHERITED{style, false} , fFontId{fontId} + , fGlyphCount{glyphCount} , fRsc{rsc} { } SkFontID fontID() const {return fFontId;} + int glyphCount() const {return fGlyphCount;} static SkTypefaceProxy* DownCast(SkTypeface* typeface) { - // TODO: how to check the safty of the down cast. - return (SkTypefaceProxy*) typeface; + // TODO: how to check the safety of the down cast? + return (SkTypefaceProxy*)typeface; } protected: @@ -159,6 +162,7 @@ protected: private: const SkFontID fFontId; + const int fGlyphCount; // const std::thread::id fThreadId; // TODO: figure out a good solutions for this. SkRemoteScalerContext* const fRsc; |