aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkStrikeCache.h
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-06-21 11:53:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-21 17:46:49 +0000
commit71cca6745578985c038e2398fefa0ccb88b9490c (patch)
tree5cc330511f6ead4be6d0d281d18ce8365d55c251 /src/core/SkStrikeCache.h
parent9ac1b729f1790ebe7716ab6d91780b3649b93f8a (diff)
Expand ExclusiveStrikePtr with StrikeCache
Add an SkStrikeCache to ExclusiveStrikePtr to allow it to return a glyph cache to one of multiple strike caches. BUG=skia:8091 Change-Id: I5440a6451838e08f21677eb5d5b4ade6c6b75ca0 Reviewed-on: https://skia-review.googlesource.com/136617 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkStrikeCache.h')
-rw-r--r--src/core/SkStrikeCache.h46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/core/SkStrikeCache.h b/src/core/SkStrikeCache.h
index dcec3de0bd..7b600181d2 100644
--- a/src/core/SkStrikeCache.h
+++ b/src/core/SkStrikeCache.h
@@ -47,7 +47,7 @@ public:
class ExclusiveStrikePtr {
public:
- explicit ExclusiveStrikePtr(Node*);
+ explicit ExclusiveStrikePtr(Node*, SkStrikeCache*);
ExclusiveStrikePtr();
ExclusiveStrikePtr(const ExclusiveStrikePtr&) = delete;
ExclusiveStrikePtr& operator = (const ExclusiveStrikePtr&) = delete;
@@ -65,18 +65,13 @@ public:
private:
Node* fNode;
+ SkStrikeCache* fStrikeCache;
};
static SkStrikeCache* GlobalStrikeCache();
static ExclusiveStrikePtr FindStrikeExclusive(const SkDescriptor&);
-
- static bool DesperationSearchForImage(const SkDescriptor& desc,
- SkGlyph* glyph,
- SkGlyphCache* targetCache);
-
- static bool DesperationSearchForPath(
- const SkDescriptor& desc, SkGlyphID glyphID, SkPath* path);
+ ExclusiveStrikePtr findStrikeExclusive(const SkDescriptor&);
static ExclusiveStrikePtr CreateStrikeExclusive(
const SkDescriptor& desc,
@@ -84,11 +79,36 @@ public:
SkPaint::FontMetrics* maybeMetrics = nullptr,
std::unique_ptr<SkStrikePinner> = nullptr);
+ ExclusiveStrikePtr createStrikeExclusive(
+ const SkDescriptor& desc,
+ std::unique_ptr<SkScalerContext> scaler,
+ SkPaint::FontMetrics* maybeMetrics = nullptr,
+ std::unique_ptr<SkStrikePinner> = nullptr);
+
static ExclusiveStrikePtr FindOrCreateStrikeExclusive(
const SkDescriptor& desc,
const SkScalerContextEffects& effects,
const SkTypeface& typeface);
+ ExclusiveStrikePtr findOrCreateStrikeExclusive(
+ const SkDescriptor& desc,
+ const SkScalerContextEffects& effects,
+ const SkTypeface& typeface);
+
+ // Routines to find suitable data when working in a remote cache situation. These are
+ // suitable as substitutes for similar calls in SkScalerContext.
+ static bool DesperationSearchForImage(const SkDescriptor& desc,
+ SkGlyph* glyph,
+ SkGlyphCache* targetCache);
+
+ bool desperationSearchForImage(const SkDescriptor& desc,
+ SkGlyph* glyph,
+ SkGlyphCache* targetCache);
+
+ static bool DesperationSearchForPath(
+ const SkDescriptor& desc, SkGlyphID glyphID, SkPath* path);
+ bool desperationSearchForPath(const SkDescriptor& desc, SkGlyphID glyphID, SkPath* path);
+
static ExclusiveStrikePtr FindOrCreateStrikeExclusive(
const SkPaint& paint,
const SkSurfaceProps* surfaceProps,
@@ -110,14 +130,9 @@ public:
// call when a glyphcache is available for caching (i.e. not in use)
void attachNode(Node* node);
- ExclusiveStrikePtr findStrikeExclusive(const SkDescriptor&);
- // Routines to find suitable data when working in a remote cache situation. These are
- // suitable as substitutes for similar calls in SkScalerContext.
- bool desperationSearchForImage(const SkDescriptor& desc,
- SkGlyph* glyph,
- SkGlyphCache* targetCache);
- bool desperationSearchForPath(const SkDescriptor& desc, SkGlyphID glyphID, SkPath* path);
+
+
void purgeAll(); // does not change budget
@@ -139,7 +154,6 @@ public:
#endif
private:
- static void Attach(Node* node);
// The following methods can only be called when mutex is already held.
Node* internalGetHead() const { return fHead; }