aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-03-07 18:05:39 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-07 18:05:51 +0000
commitab6fd7ef91aeca8a3fbbc6c6670cb89a5a7b6d53 (patch)
treee98936f124d58dafe85aab73b3a85fd8279e1d8a /src/core/SkGlyphCache.cpp
parente64b064f87018cc84ad843b3cad3185f87917fe8 (diff)
Revert "Remove attach and detach glyph cache."
This reverts commit 61d56b92a4076f8afd644d015913641d691e39c8. Reason for revert: broke gldft text Original change's description: > Remove attach and detach glyph cache. > > BUG=skia:7515 > > Change-Id: Ib978e3cf4cfffdefe6453feb520e5e73684abf2e > Reviewed-on: https://skia-review.googlesource.com/112560 > Reviewed-by: Ben Wagner <bungeman@google.com> > Commit-Queue: Herb Derby <herb@google.com> TBR=bungeman@google.com,herb@google.com Change-Id: Id5723a3abcd103ed20197bba2dab06e8074be633 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7515 Reviewed-on: https://skia-review.googlesource.com/112745 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkGlyphCache.cpp')
-rw-r--r--src/core/SkGlyphCache.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index 668f0e49b2..9bb43604a6 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -505,23 +505,6 @@ SkExclusiveStrikePtr SkGlyphCache::FindOrCreateStrikeExclusive(
return FindOrCreateStrikeExclusive(desc, creator);
}
-SkExclusiveStrikePtr SkGlyphCache::FindOrCreateStrikeExclusive(
- const SkPaint& paint,
- const SkSurfaceProps* surfaceProps,
- SkScalerContextFlags scalerContextFlags,
- const SkMatrix* deviceMatrix)
-{
- SkAutoDescriptor ad;
- SkScalerContextEffects effects;
-
- auto desc = SkScalerContext::CreateDescriptorAndEffectsUsingPaint(
- paint, surfaceProps, scalerContextFlags, deviceMatrix, &ad, &effects);
-
- auto tf = SkPaintPriv::GetTypefaceOrDefault(paint);
-
- return FindOrCreateStrikeExclusive(*desc, effects, *tf);
-}
-
void SkGlyphCache::AttachCache(SkGlyphCache* cache) {
SkGlyphCache_Globals::AttachCache(cache);
}
@@ -803,3 +786,22 @@ void SkGraphics::PurgeFontCache() {
size_t SkGraphics::GetTLSFontCacheLimit() { return 0; }
void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { }
+SkGlyphCache* SkGlyphCache::DetachCache(
+ SkTypeface* typeface, const SkScalerContextEffects& effects, const SkDescriptor* desc)
+{
+ auto cache = FindOrCreateStrikeExclusive(*desc, effects, *typeface);
+ return cache.release();
+}
+
+SkGlyphCache* SkGlyphCache::DetachCacheUsingPaint(const SkPaint& paint,
+ const SkSurfaceProps* surfaceProps,
+ SkScalerContextFlags scalerContextFlags,
+ const SkMatrix* deviceMatrix) {
+ SkAutoDescriptor ad;
+ SkScalerContextEffects effects;
+
+ auto desc = SkScalerContext::CreateDescriptorAndEffectsUsingPaint(
+ paint, surfaceProps, scalerContextFlags, deviceMatrix, &ad, &effects);
+
+ return SkGlyphCache::DetachCache(SkPaintPriv::GetTypefaceOrDefault(paint), effects, desc);
+}