Make GrAtlasTextBlob::run own effects it points to.
BUG=chromium:608566
Currently the run has bare pointers and the effects can be destroyed while a run is pointing at them.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1993213003
Review-Url: https://codereview.chromium.org/1993213003
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 54af7af..13c96b5 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -58,9 +58,13 @@
// if we have an override descriptor for the run, then we should use that
SkAutoDescriptor* desc = run->fOverrideDescriptor.get() ? run->fOverrideDescriptor.get() :
&run->fDescriptor;
- skPaint.getScalerContextDescriptor(&run->fEffects, desc, props, scalerContextFlags, viewMatrix);
+ SkScalerContextEffects effects;
+ skPaint.getScalerContextDescriptor(&effects, desc, props, scalerContextFlags, viewMatrix);
run->fTypeface.reset(SkSafeRef(skPaint.getTypeface()));
- return SkGlyphCache::DetachCache(run->fTypeface, run->fEffects, desc->getDesc());
+ run->fPathEffect = sk_ref_sp(effects.fPathEffect);
+ run->fRasterizer = sk_ref_sp(effects.fRasterizer);
+ run->fMaskFilter = sk_ref_sp(effects.fMaskFilter);
+ return SkGlyphCache::DetachCache(run->fTypeface, effects, desc->getDesc());
}
void GrAtlasTextBlob::appendGlyph(int runIndex,