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; |
} |