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>
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index d8611fe..ea699fb 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -12,6 +12,7 @@
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
+#include "GrPath.h"
#include "GrPathRendering.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetPriv.h"
@@ -198,11 +199,11 @@
return tex;
}
- tex.reset(fGpu->createTexture(desc, budgeted));
- return tex;
+ return fGpu->createTexture(desc, budgeted);
}
-GrTexture* GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc, uint32_t flags) {
+sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc,
+ uint32_t flags) {
ASSERT_SINGLE_OWNER
SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
@@ -217,7 +218,8 @@
return this->refScratchTexture(desc, flags);
}
-GrTexture* GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDesc, uint32_t flags) {
+sk_sp<GrTexture> GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDesc,
+ uint32_t flags) {
ASSERT_SINGLE_OWNER
SkASSERT(!this->isAbandoned());
SkASSERT(validate_desc(inDesc, *fCaps));
@@ -250,7 +252,7 @@
scratchFlags);
if (resource) {
GrSurface* surface = static_cast<GrSurface*>(resource);
- return surface->asTexture();
+ return sk_sp<GrTexture>(surface->asTexture());
}
}
@@ -379,21 +381,21 @@
return this->createPatternedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadIndexBufferKey);
}
-GrPath* GrResourceProvider::createPath(const SkPath& path, const GrStyle& style) {
+sk_sp<GrPath> GrResourceProvider::createPath(const SkPath& path, const GrStyle& style) {
SkASSERT(this->gpu()->pathRendering());
return this->gpu()->pathRendering()->createPath(path, style);
}
-GrPathRange* GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen,
- const GrStyle& style) {
+sk_sp<GrPathRange> GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen,
+ const GrStyle& style) {
SkASSERT(this->gpu()->pathRendering());
return this->gpu()->pathRendering()->createPathRange(gen, style);
}
-GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf,
- const SkScalerContextEffects& effects,
- const SkDescriptor* desc,
- const GrStyle& style) {
+sk_sp<GrPathRange> GrResourceProvider::createGlyphs(const SkTypeface* tf,
+ const SkScalerContextEffects& effects,
+ const SkDescriptor* desc,
+ const GrStyle& style) {
SkASSERT(this->gpu()->pathRendering());
return this->gpu()->pathRendering()->createGlyphs(tf, effects, desc, style);