Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: src/core/SkImageFilter.cpp

Issue 1812023002: Switch SkSpecialImage & SkSpecialSurface classes over to smart pointers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/core/SkSpecialImage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 85f4e468dd699a8a75f62819f99960439dc8adfa..1a4c876d61c5ed75346e308a495a2cf73af9b609 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -275,12 +275,12 @@ bool SkImageFilter::filterInputDeprecated(int index, Proxy* proxy, const SkBitma
return true;
}
- SkAutoTUnref<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src));
+ sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src));
if (!specialSrc) {
return false;
}
- SkAutoTUnref<SkSpecialImage> tmp(input->onFilterImage(specialSrc,
+ SkAutoTUnref<SkSpecialImage> tmp(input->onFilterImage(specialSrc.get(),
this->mapContext(ctx),
offset));
if (!tmp) {
@@ -367,7 +367,7 @@ SkSpecialImage* SkImageFilter::onFilterImage(SkSpecialImage* src, const Context&
return nullptr;
}
- return SkSpecialImage::internal_fromBM(src->internal_getProxy(), resultBM);
+ return SkSpecialImage::internal_fromBM(src->internal_getProxy(), resultBM).release();
}
bool SkImageFilter::canFilterImageGPU() const {
@@ -484,11 +484,11 @@ bool SkImageFilter::applyCropRectDeprecated(const Context& ctx, Proxy* proxy, co
// Return a larger (newWidth x newHeight) copy of 'src' with black padding
// around it.
-static SkSpecialImage* pad_image(SkSpecialImage* src,
- int newWidth, int newHeight, int offX, int offY) {
+static sk_sp<SkSpecialImage> pad_image(SkSpecialImage* src,
+ int newWidth, int newHeight, int offX, int offY) {
SkImageInfo info = SkImageInfo::MakeN32Premul(newWidth, newHeight);
- SkAutoTUnref<SkSpecialSurface> surf(src->newSurface(info));
+ sk_sp<SkSpecialSurface> surf(src->makeSurface(info));
if (!surf) {
return nullptr;
}
@@ -500,7 +500,7 @@ static SkSpecialImage* pad_image(SkSpecialImage* src,
src->draw(canvas, offX, offY, nullptr);
- return surf->newImageSnapshot();
+ return surf->makeImageSnapshot();
}
SkSpecialImage* SkImageFilter::applyCropRect(const Context& ctx,
@@ -520,12 +520,12 @@ SkSpecialImage* SkImageFilter::applyCropRect(const Context& ctx,
if (srcBounds.contains(*bounds)) {
return SkRef(src);
} else {
- SkSpecialImage* img = pad_image(src,
- bounds->width(), bounds->height(),
- srcOffset->x() - bounds->x(),
- srcOffset->y() - bounds->y());
+ sk_sp<SkSpecialImage> img(pad_image(src,
+ bounds->width(), bounds->height(),
+ srcOffset->x() - bounds->x(),
+ srcOffset->y() - bounds->y()));
*srcOffset = SkIPoint::Make(bounds->x(), bounds->y());
- return img;
+ return img.release();
}
}
@@ -609,12 +609,12 @@ bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr
return true;
}
- SkAutoTUnref<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src));
+ sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src));
if (!specialSrc) {
return false;
}
- SkAutoTUnref<SkSpecialImage> tmp(input->onFilterImage(specialSrc,
+ SkAutoTUnref<SkSpecialImage> tmp(input->onFilterImage(specialSrc.get(),
this->mapContext(ctx),
offset));
if (!tmp) {
« no previous file with comments | « src/core/SkDevice.cpp ('k') | src/core/SkSpecialImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698