Index: src/image/SkImage_Generator.cpp |
diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp |
index 95cc426a43225d8819a107ddf50ae40bbabb0bb1..62b492e2881cab8c585174b3ca26c3d613bc7e30 100644 |
--- a/src/image/SkImage_Generator.cpp |
+++ b/src/image/SkImage_Generator.cpp |
@@ -25,7 +25,7 @@ public: |
SkImageCacherator* peekCacherator() const override { return fCache; } |
SkData* onRefEncoded(GrContext*) const override; |
bool isOpaque() const override { return fCache->info().isOpaque(); } |
- SkImage* onNewSubset(const SkIRect&) const override; |
+ sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; |
bool getROPixels(SkBitmap*, CachingHint) const override; |
GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const override; |
bool onIsLazyGenerated() const override { return true; } |
@@ -73,7 +73,7 @@ GrTexture* SkImage_Generator::asTextureRef(GrContext* ctx, const GrTextureParams |
return fCache->lockAsTexture(ctx, params, this); |
} |
-SkImage* SkImage_Generator::onNewSubset(const SkIRect& subset) const { |
+sk_sp<SkImage> SkImage_Generator::onMakeSubset(const SkIRect& subset) const { |
// TODO: make this lazy, by wrapping the subset inside a new generator or something |
// For now, we do effectively what we did before, make it a raster |
@@ -86,13 +86,16 @@ SkImage* SkImage_Generator::onNewSubset(const SkIRect& subset) const { |
surface->getCanvas()->clear(0); |
surface->getCanvas()->drawImage(this, SkIntToScalar(-subset.x()), SkIntToScalar(-subset.y()), |
nullptr); |
- return surface->newImageSnapshot(); |
+ return sk_sp<SkImage>(surface->newImageSnapshot()); |
} |
-SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator, const SkIRect* subset) { |
+sk_sp<SkImage> SkImage::MakeFromGenerator(SkImageGenerator* generator, const SkIRect* subset) { |
+ if (!generator) { |
+ return nullptr; |
+ } |
SkImageCacherator* cache = SkImageCacherator::NewFromGenerator(generator, subset); |
if (!cache) { |
return nullptr; |
} |
- return new SkImage_Generator(cache); |
+ return sk_make_sp<SkImage_Generator>(cache); |
} |