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

Unified Diff: src/core/SkReadBuffer.cpp

Issue 1789443002: Revert "Revert of add Make variations to return SkImage by sk_sp (patchset #5 id:80001 of https://c… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use get, not release, when calling legacy function that wants ptr 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/SkPictureShader.cpp ('k') | src/core/SkShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkReadBuffer.cpp
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 6823a6cd8e7c1d51c9aebc531b895b5081fa0ea1..59d5172f8144a66e5e9dafff6b6a9f775b73020a 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -298,11 +298,11 @@ SkImage* SkReadBuffer::readImage() {
return nullptr;
}
- SkAutoTUnref<SkData> encoded(this->readByteArrayAsData());
+ sk_sp<SkData> encoded(this->readByteArrayAsData());
if (encoded->size() == 0) {
// The image could not be encoded at serialization time - return an empty placeholder.
- return SkImage::NewFromGenerator(
- new EmptyImageGenerator(SkImageInfo::MakeN32Premul(width, height)));
+ return SkImage::MakeFromGenerator(
+ new EmptyImageGenerator(SkImageInfo::MakeN32Premul(width, height))).release();
}
int originX = this->read32();
@@ -313,13 +313,13 @@ SkImage* SkReadBuffer::readImage() {
}
const SkIRect subset = SkIRect::MakeXYWH(originX, originY, width, height);
- SkImage* image = SkImage::NewFromEncoded(encoded, &subset);
+ SkImage* image = SkImage::MakeFromEncoded(std::move(encoded), &subset).release();
if (image) {
return image;
}
- return SkImage::NewFromGenerator(
- new EmptyImageGenerator(SkImageInfo::MakeN32Premul(width, height)));
+ return SkImage::MakeFromGenerator(
+ new EmptyImageGenerator(SkImageInfo::MakeN32Premul(width, height))).release();
}
SkTypeface* SkReadBuffer::readTypeface() {
« no previous file with comments | « src/core/SkPictureShader.cpp ('k') | src/core/SkShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698