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

Unified Diff: src/utils/SkTextureCompressor.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/utils/SkTextureCompressor.cpp
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index 086214ec596c0b578a74e5581fab61970c45c652..e9e4d2e826c1167c274a64246a8ac33a20621bfa 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -145,19 +145,18 @@ bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType srcCol
return false;
}
-SkData* CompressBitmapToFormat(const SkPixmap& pixmap, Format format) {
+sk_sp<SkData> CompressBitmapToFormat(const SkPixmap& pixmap, Format format) {
int compressedDataSize = GetCompressedDataSize(format, pixmap.width(), pixmap.height());
if (compressedDataSize < 0) {
return nullptr;
}
const uint8_t* src = reinterpret_cast<const uint8_t*>(pixmap.addr());
- SkData* dst = SkData::NewUninitialized(compressedDataSize);
+ sk_sp<SkData> dst(SkData::MakeUninitialized(compressedDataSize));
if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, pixmap.colorType(),
pixmap.width(), pixmap.height(), pixmap.rowBytes(), format)) {
- dst->unref();
- dst = nullptr;
+ return nullptr;
}
return dst;
}

Powered by Google App Engine
This is Rietveld 408576698