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

Unified Diff: src/codec/SkRawCodec.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/codec/SkRawCodec.cpp
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index 9c32e709d81dfdfb2ebff4300e1f1b34fbcb3f81..37d2d358aead77c5ea08e6951ddbc8644707252d 100644
--- a/src/codec/SkRawCodec.cpp
+++ b/src/codec/SkRawCodec.cpp
@@ -257,7 +257,7 @@ public:
}
SkMemoryStream* transferBuffer(size_t offset, size_t size) override {
- SkAutoTUnref<SkData> data(SkData::NewUninitialized(size));
+ sk_sp<SkData> data(SkData::MakeUninitialized(size));
if (offset > fStreamBuffer.bytesWritten()) {
// If the offset is not buffered, read from fStream directly and skip the buffering.
const size_t skipLength = offset - fStreamBuffer.bytesWritten();
@@ -266,7 +266,7 @@ public:
}
const size_t bytesRead = fStream->read(data->writable_data(), size);
if (bytesRead < size) {
- data.reset(SkData::NewSubset(data.get(), 0, bytesRead));
+ data = SkData::MakeSubset(data.get(), 0, bytesRead);
}
} else {
const size_t alreadyBuffered = SkTMin(fStreamBuffer.bytesWritten() - offset, size);
@@ -284,7 +284,7 @@ public:
if (!safe_add_to_size_t(alreadyBuffered, bytesRead, &newSize)) {
return nullptr;
}
- data.reset(SkData::NewSubset(data.get(), 0, newSize));
+ data = SkData::MakeSubset(data.get(), 0, newSize);
}
}
}
@@ -379,18 +379,18 @@ public:
}
if (fStream->getMemoryBase()) { // directly copy if getMemoryBase() is available.
- SkAutoTUnref<SkData> data(SkData::NewWithCopy(
+ sk_sp<SkData> data(SkData::MakeWithCopy(
static_cast<const uint8_t*>(fStream->getMemoryBase()) + offset, bytesToRead));
fStream.reset();
return new SkMemoryStream(data);
} else {
- SkAutoTUnref<SkData> data(SkData::NewUninitialized(bytesToRead));
+ sk_sp<SkData> data(SkData::MakeUninitialized(bytesToRead));
if (!fStream->seek(offset)) {
return nullptr;
}
const size_t bytesRead = fStream->read(data->writable_data(), bytesToRead);
if (bytesRead < bytesToRead) {
- data.reset(SkData::NewSubset(data.get(), 0, bytesRead));
+ data = SkData::MakeSubset(data.get(), 0, bytesRead);
}
return new SkMemoryStream(data);
}
« include/core/SkData.h ('K') | « src/codec/SkIcoCodec.cpp ('k') | src/codec/SkWbmpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698