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

Unified Diff: src/effects/SkPictureImageFilter.cpp

Issue 1831323003: Swap SkPictureImageFilter's factories over to smart pointers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix sk_sp bug 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 | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkPictureImageFilter.cpp
diff --git a/src/effects/SkPictureImageFilter.cpp b/src/effects/SkPictureImageFilter.cpp
index 14c14bb1762f4785e04819d91a10ca1053dd2c0a..8f8853ec36e7f8c3fc009306d5dfd2f9c08cbf5a 100644
--- a/src/effects/SkPictureImageFilter.cpp
+++ b/src/effects/SkPictureImageFilter.cpp
@@ -13,28 +13,24 @@
#include "SkWriteBuffer.h"
#include "SkValidationUtils.h"
-SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture)
+SkPictureImageFilter::SkPictureImageFilter(sk_sp<SkPicture> picture)
: INHERITED(0, 0, nullptr)
- , fPicture(SkSafeRef(picture))
- , fCropRect(picture ? picture->cullRect() : SkRect::MakeEmpty())
+ , fPicture(std::move(picture))
+ , fCropRect(fPicture ? fPicture->cullRect() : SkRect::MakeEmpty())
, fPictureResolution(kDeviceSpace_PictureResolution)
, fFilterQuality(kLow_SkFilterQuality) {
}
-SkPictureImageFilter::SkPictureImageFilter(const SkPicture* picture, const SkRect& cropRect,
+SkPictureImageFilter::SkPictureImageFilter(sk_sp<SkPicture> picture, const SkRect& cropRect,
PictureResolution pictureResolution,
SkFilterQuality filterQuality)
: INHERITED(0, 0, nullptr)
- , fPicture(SkSafeRef(picture))
+ , fPicture(std::move(picture))
, fCropRect(cropRect)
, fPictureResolution(pictureResolution)
, fFilterQuality(filterQuality) {
}
-SkPictureImageFilter::~SkPictureImageFilter() {
- SkSafeUnref(fPicture);
-}
-
SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) {
sk_sp<SkPicture> picture;
SkRect cropRect;
@@ -62,9 +58,9 @@ SkFlattenable* SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) {
} else {
filterQuality = (SkFilterQuality)buffer.readInt();
}
- return CreateForLocalSpace(picture.get(), cropRect, filterQuality);
+ return MakeForLocalSpace(picture, cropRect, filterQuality).release();
}
- return Create(picture.get(), cropRect);
+ return Make(picture, cropRect).release();
}
void SkPictureImageFilter::flatten(SkWriteBuffer& buffer) const {
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698