aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-06-05 13:38:13 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-05 18:07:05 +0000
commit67d52cf0d8baff02fd4337a62f1f9cd975edc18f (patch)
treea17ca628b4013026f5628e5841e44b48e6128a13 /src/gpu/text
parentbab680d891a201f27b87343a692a902d00d67c0a (diff)
sk_sp-ify GrResourceProvider some more
I believe this addresses the concerns of this particular bug (although more remains to be done) Bug: skia:5327 Change-Id: Ie82f08f87b3cf3d7986fe4eeb16a5d2553173913 Reviewed-on: https://skia-review.googlesource.com/18599 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp12
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index d2872d246f..6108e7ae44 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -527,11 +527,13 @@ void GrStencilAndCoverTextContext::TextRun::setPosText(const char text[], size_t
fFallbackTextBlob = fallback.makeIfNeeded(&fFallbackGlyphCount);
}
-GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(
+sk_sp<GrPathRange> GrStencilAndCoverTextContext::TextRun::createGlyphs(
GrResourceProvider* resourceProvider) const {
- GrPathRange* glyphs = static_cast<GrPathRange*>(
- resourceProvider->findAndRefResourceByUniqueKey(fGlyphPathsKey));
- if (nullptr == glyphs) {
+ sk_sp<GrPathRange> glyphs;
+
+ glyphs.reset(static_cast<GrPathRange*>(
+ resourceProvider->findAndRefResourceByUniqueKey(fGlyphPathsKey)));
+ if (!glyphs) {
if (fUsingRawGlyphPaths) {
SkScalerContextEffects noeffects;
glyphs = resourceProvider->createGlyphs(fFont.getTypeface(), noeffects,
@@ -543,7 +545,7 @@ GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(
&cache->getDescriptor(),
fStyle);
}
- resourceProvider->assignUniqueKeyToResource(fGlyphPathsKey, glyphs);
+ resourceProvider->assignUniqueKeyToResource(fGlyphPathsKey, glyphs.get());
}
return glyphs;
}
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h
index 54c0a9d758..49bba4f4f6 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.h
+++ b/src/gpu/text/GrStencilAndCoverTextContext.h
@@ -89,7 +89,7 @@ private:
typedef GrDrawPathRangeOp::InstanceData InstanceData;
SkGlyphCache* getGlyphCache() const;
- GrPathRange* createGlyphs(GrResourceProvider*) const;
+ sk_sp<GrPathRange> createGlyphs(GrResourceProvider*) const;
void appendGlyph(const SkGlyph&, const SkPoint&, FallbackBlobBuilder*);
GrStyle fStyle;