Index: src/utils/SkTextureCompressor.cpp |
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp |
index 9d29d51d6084e02765ad0e13cdbc13f19cf2c6ee..12621e118f9275f394500008d6a29e2ace4ac369 100644 |
--- a/src/utils/SkTextureCompressor.cpp |
+++ b/src/utils/SkTextureCompressor.cpp |
@@ -173,17 +173,19 @@ |
return false; |
} |
-SkData* CompressBitmapToFormat(const SkPixmap& pixmap, Format format) { |
- int compressedDataSize = GetCompressedDataSize(format, pixmap.width(), pixmap.height()); |
+SkData* CompressBitmapToFormat(const SkBitmap &bitmap, Format format) { |
+ SkAutoLockPixels alp(bitmap); |
+ |
+ int compressedDataSize = GetCompressedDataSize(format, bitmap.width(), bitmap.height()); |
if (compressedDataSize < 0) { |
return NULL; |
} |
- const uint8_t* src = reinterpret_cast<const uint8_t*>(pixmap.addr()); |
+ const uint8_t* src = reinterpret_cast<const uint8_t*>(bitmap.getPixels()); |
SkData* dst = SkData::NewUninitialized(compressedDataSize); |
- if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, pixmap.colorType(), |
- pixmap.width(), pixmap.height(), pixmap.rowBytes(), format)) { |
+ if (!CompressBufferToFormat((uint8_t*)dst->writable_data(), src, bitmap.colorType(), |
+ bitmap.width(), bitmap.height(), bitmap.rowBytes(), format)) { |
dst->unref(); |
dst = NULL; |
} |