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

Unified Diff: src/effects/SkImageSource.cpp

Issue 1842243002: Update SkImageSource to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT 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') | src/utils/SkBitmapSourceDeserializer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkImageSource.cpp
diff --git a/src/effects/SkImageSource.cpp b/src/effects/SkImageSource.cpp
index f095df69a8e5458c45187c13b8da8ab59e515e87..f16e5a140fcdcae62d45d593c79e3ae96681bb4e 100644
--- a/src/effects/SkImageSource.cpp
+++ b/src/effects/SkImageSource.cpp
@@ -15,33 +15,25 @@
#include "SkWriteBuffer.h"
#include "SkString.h"
-SkImageFilter* SkImageSource::Create(SkImage* image) {
- return image ? new SkImageSource(image) : nullptr;
-}
-
-SkImageFilter* SkImageSource::Create(SkImage* image,
- const SkRect& srcRect,
- const SkRect& dstRect,
- SkFilterQuality filterQuality) {
- return image ? new SkImageSource(image, srcRect, dstRect, filterQuality) : nullptr;
-}
-SkImageSource::SkImageSource(SkImage* image)
+SkImageSource::SkImageSource(sk_sp<SkImage> image)
: INHERITED(0, nullptr)
- , fImage(SkRef(image))
- , fSrcRect(SkRect::MakeIWH(image->width(), image->height()))
+ , fImage(std::move(image))
+ , fSrcRect(SkRect::MakeIWH(fImage->width(), fImage->height()))
, fDstRect(fSrcRect)
- , fFilterQuality(kHigh_SkFilterQuality) { }
+ , fFilterQuality(kHigh_SkFilterQuality) {
+}
-SkImageSource::SkImageSource(SkImage* image,
+SkImageSource::SkImageSource(sk_sp<SkImage> image,
const SkRect& srcRect,
const SkRect& dstRect,
SkFilterQuality filterQuality)
: INHERITED(0, nullptr)
- , fImage(SkRef(image))
+ , fImage(std::move(image))
, fSrcRect(srcRect)
, fDstRect(dstRect)
- , fFilterQuality(filterQuality) { }
+ , fFilterQuality(filterQuality) {
+}
SkFlattenable* SkImageSource::CreateProc(SkReadBuffer& buffer) {
SkFilterQuality filterQuality = (SkFilterQuality)buffer.readInt();
@@ -50,12 +42,12 @@ SkFlattenable* SkImageSource::CreateProc(SkReadBuffer& buffer) {
buffer.readRect(&src);
buffer.readRect(&dst);
- SkAutoTUnref<SkImage> image(buffer.readImage());
+ sk_sp<SkImage> image(buffer.readImage());
if (!image) {
return nullptr;
}
- return SkImageSource::Create(image, src, dst, filterQuality);
+ return SkImageSource::Make(std::move(image), src, dst, filterQuality).release();
}
void SkImageSource::flatten(SkWriteBuffer& buffer) const {
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/utils/SkBitmapSourceDeserializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698