Use descriptor instead of cache for GrStrikeCache lookup
Change-Id: Ia8e82344d3d8b394a6d9cc14d56dcf0addeff96c Reviewed-on: https://skia-review.googlesource.com/c/191220 Commit-Queue: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Auto-Submit: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
b7d64b989e
commit
30595ea7c7
@ -697,7 +697,7 @@ void GrTextBlob::generateFromGlyphRunList(GrStrikeCache* glyphCache,
|
||||
auto subRun = fRun->initARGBFallback();
|
||||
SkExclusiveStrikePtr fallbackCache = SkStrikeCache::FindOrCreateStrikeExclusive(
|
||||
fallbackFont, fallbackPaint, fProps, fScalerContextFlags, glyphCacheMatrix);
|
||||
sk_sp<GrTextStrike> strike = fGrStrikeCache->getStrike(fallbackCache.get());
|
||||
sk_sp<GrTextStrike> strike = fGrStrikeCache->getStrike(fallbackCache->getDescriptor());
|
||||
fRun->setupFont(fallbackPaint, fallbackFont, fallbackCache->getDescriptor());
|
||||
|
||||
SkASSERT(strike != nullptr);
|
||||
@ -762,7 +762,7 @@ void GrTextBlob::generateFromGlyphRunList(GrStrikeCache* glyphCache,
|
||||
{
|
||||
SkExclusiveStrikePtr cache =SkStrikeCache::FindOrCreateStrikeExclusive(
|
||||
distanceFieldFont, distanceFieldPaint, props, flags, SkMatrix::I());
|
||||
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache.get());
|
||||
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache->getDescriptor());
|
||||
run->setupFont(distanceFieldPaint, distanceFieldFont, cache->getDescriptor());
|
||||
|
||||
auto perEmpty = [](const SkGlyph&, SkPoint) {};
|
||||
@ -835,7 +835,7 @@ void GrTextBlob::generateFromGlyphRunList(GrStrikeCache* glyphCache,
|
||||
auto processMasks =
|
||||
[run, cache{cache.get()}, glyphCache]
|
||||
(SkSpan<const SkGlyphRunListPainter::GlyphAndPos> masks) {
|
||||
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache);
|
||||
sk_sp<GrTextStrike> currStrike = glyphCache->getStrike(cache->getDescriptor());
|
||||
for (const auto& mask : masks) {
|
||||
SkPoint pt{SkScalarFloorToScalar(mask.position.fX),
|
||||
SkScalarFloorToScalar(mask.position.fY)};
|
||||
|
@ -112,10 +112,10 @@ public:
|
||||
// another client of the cache may cause the strike to be purged while it is still reffed.
|
||||
// Therefore, the caller must check GrTextStrike::isAbandoned() if there are other
|
||||
// interactions with the cache since the strike was received.
|
||||
sk_sp<GrTextStrike> getStrike(const SkStrike* cache) {
|
||||
sk_sp<GrTextStrike> strike = sk_ref_sp(fCache.find(cache->getDescriptor()));
|
||||
sk_sp<GrTextStrike> getStrike(const SkDescriptor& desc) {
|
||||
sk_sp<GrTextStrike> strike = sk_ref_sp(fCache.find(desc));
|
||||
if (!strike) {
|
||||
strike = this->generateStrike(cache);
|
||||
strike = this->generateStrike(desc);
|
||||
}
|
||||
return strike;
|
||||
}
|
||||
@ -127,9 +127,9 @@ public:
|
||||
static void HandleEviction(GrDrawOpAtlas::AtlasID, void*);
|
||||
|
||||
private:
|
||||
sk_sp<GrTextStrike> generateStrike(const SkStrike* cache) {
|
||||
sk_sp<GrTextStrike> generateStrike(const SkDescriptor& desc) {
|
||||
// 'fCache' get the construction ref
|
||||
sk_sp<GrTextStrike> strike = sk_ref_sp(new GrTextStrike(cache->getDescriptor()));
|
||||
sk_sp<GrTextStrike> strike = sk_ref_sp(new GrTextStrike(desc));
|
||||
fCache.add(strike.get());
|
||||
return strike;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
|
||||
}
|
||||
|
||||
if (regenGlyphs) {
|
||||
strike = fGlyphCache->getStrike(fLazyCache->get());
|
||||
strike = fGlyphCache->getStrike((*fLazyCache)->getDescriptor());
|
||||
} else {
|
||||
strike = fSubRun->refStrike();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user