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/core/SkWriteBuffer.cpp

Issue 2206633004: Move off SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Gotta catch 'em all. Created 4 years, 4 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
Index: src/core/SkWriteBuffer.cpp
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index ccf1f37dd8fb890593665f177f248949218a38f7..e954399b0994eac3c352956b642b534eeefcdeda 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -144,13 +144,13 @@ void SkBinaryWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
SkPixelRef* pixelRef = bitmap.pixelRef();
if (pixelRef) {
// see if the pixelref already has an encoded version
- SkAutoDataUnref existingData(pixelRef->refEncodedData());
- if (existingData.get() != nullptr) {
+ sk_sp<SkData> existingData(pixelRef->refEncodedData());
+ if (existingData) {
// Assumes that if the client did not set a serializer, they are
// happy to get the encoded data.
if (!fPixelSerializer || fPixelSerializer->useEncodedData(existingData->data(),
existingData->size())) {
- write_encoded_bitmap(this, existingData, bitmap.pixelRefOrigin());
+ write_encoded_bitmap(this, existingData.get(), bitmap.pixelRefOrigin());
return;
}
}
@@ -158,11 +158,11 @@ void SkBinaryWriteBuffer::writeBitmap(const SkBitmap& bitmap) {
// see if the caller wants to manually encode
SkAutoPixmapUnlock result;
if (fPixelSerializer && bitmap.requestLock(&result)) {
- SkAutoDataUnref data(fPixelSerializer->encode(result.pixmap()));
- if (data.get() != nullptr) {
+ sk_sp<SkData> data(fPixelSerializer->encode(result.pixmap()));
+ if (data) {
// if we have to "encode" the bitmap, then we assume there is no
// offset to share, since we are effectively creating a new pixelref
- write_encoded_bitmap(this, data, SkIPoint::Make(0, 0));
+ write_encoded_bitmap(this, data.get(), SkIPoint::Make(0, 0));
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698