diff options
author | Herb Derby <herb@google.com> | 2018-03-21 16:23:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-26 21:28:04 +0000 |
commit | 97be88f58a82b8e6ad7ef60a072cd8407d6423ce (patch) | |
tree | 89d5c94f0afef2662c870b57af7c9cf12491ac53 /src/core/SkTypeface_remote.h | |
parent | f9e12df94f7f4eacb1072415909b9c92be293130 (diff) |
Move cache difference code into remote cache files
BUG=skia:7515
Change-Id: I59e75d460b4ed4d0a737c833520b2335808a4ce4
Reviewed-on: https://skia-review.googlesource.com/115706
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkTypeface_remote.h')
-rw-r--r-- | src/core/SkTypeface_remote.h | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/src/core/SkTypeface_remote.h b/src/core/SkTypeface_remote.h index af90367d26..485982aa2d 100644 --- a/src/core/SkTypeface_remote.h +++ b/src/core/SkTypeface_remote.h @@ -16,44 +16,21 @@ #include "SkScalerContext.h" #include "SkTypeface.h" -#include <thread> - +class SkStrikeClient; class SkTypefaceProxy; -class SkRemoteScalerContext { -public: - virtual ~SkRemoteScalerContext() {} - // TODO: do metrics need effects? - virtual void generateFontMetrics( - const SkTypefaceProxy& tf, - const SkScalerContextRec& rec, - SkPaint::FontMetrics*) = 0; - virtual void generateMetricsAndImage( - const SkTypefaceProxy& tf, - const SkScalerContextRec& rec, - SkArenaAlloc* alloc, - SkGlyph* glyph) = 0; - virtual void generatePath( - const SkTypefaceProxy& tf, - const SkScalerContextRec& rec, - SkGlyphID glyph, SkPath* path) = 0; -}; - class SkScalerContextProxy : public SkScalerContext { public: SkScalerContextProxy( sk_sp<SkTypeface> tf, const SkScalerContextEffects& effects, const SkDescriptor* desc, - SkRemoteScalerContext* rsc); + SkStrikeClient* rsc); protected: - unsigned generateGlyphCount(void) override { SK_ABORT("Should never be called."); return 0;} - uint16_t generateCharToGlyph(SkUnichar uni) override { - SK_ABORT("Should never be called."); - return 0; - } - void generateAdvance(SkGlyph* glyph) override { this->generateMetrics(glyph); } + unsigned generateGlyphCount() override; + uint16_t generateCharToGlyph(SkUnichar) override; + void generateAdvance(SkGlyph* glyph) override; void generateMetrics(SkGlyph* glyph) override; void generateImage(const SkGlyph& glyph) override; void generatePath(SkGlyphID glyphID, SkPath* path) override; @@ -68,8 +45,8 @@ private: SkTypefaceProxy* typefaceProxy(); - SkArenaAlloc fAlloc{kMinAllocAmount}; - SkRemoteScalerContext* const fRemote; + SkArenaAlloc fAlloc{kMinAllocAmount}; + SkStrikeClient* const fClient; typedef SkScalerContext INHERITED; }; @@ -80,12 +57,12 @@ public: int glyphCount, const SkFontStyle& style, bool isFixed, - SkRemoteScalerContext* rsc) + SkStrikeClient* rsc) : INHERITED{style, false} , fFontId{fontId} , fGlyphCount{glyphCount} , fRsc{rsc} { } - SkFontID fontID() const {return fFontId;} + SkFontID remoteTypefaceID() const {return fFontId;} int glyphCount() const {return fGlyphCount;} static SkTypefaceProxy* DownCast(SkTypeface* typeface) { // TODO: how to check the safety of the down cast? @@ -124,8 +101,6 @@ protected: } SkScalerContext* onCreateScalerContext(const SkScalerContextEffects& effects, const SkDescriptor* desc) const override { - //std::cout << fFontId << fThreadId; - return new SkScalerContextProxy(sk_ref_sp(const_cast<SkTypefaceProxy*>(this)), effects, desc, fRsc); @@ -161,10 +136,9 @@ protected: } private: - const SkFontID fFontId; - const int fGlyphCount; - // const std::thread::id fThreadId; // TODO: figure out a good solutions for this. - SkRemoteScalerContext* const fRsc; + const SkFontID fFontId; + const int fGlyphCount; + SkStrikeClient* const fRsc; typedef SkTypeface INHERITED; }; |