Revert of change SkDraw and all Blitters to use pixmap instead of bitmap (patchset #6 id:100001 of https://codereview.chromium.org/1148793007/)
Reason for revert:
speculative revert to try to unblock DEPS roll
Original issue's description:
> change SkDraw and all Blitters to use pixmap instead of bitmap
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c31af44336f5eb4a50e83e76e51962d46c3ed458
TBR=scroggo@google.com,jvanverth@google.com,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1164373003
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index 9d29d51..12621e1 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;
}
diff --git a/src/utils/SkTextureCompressor.h b/src/utils/SkTextureCompressor.h
index e31a5ab..e35bc95 100644
--- a/src/utils/SkTextureCompressor.h
+++ b/src/utils/SkTextureCompressor.h
@@ -55,10 +55,10 @@
int GetCompressedDataSize(Format fmt, int width, int height);
// Returns an SkData holding a blob of compressed data that corresponds
- // to the pixmap. If the pixmap colorType cannot be compressed using the
+ // to the bitmap. If the bitmap colorType cannot be compressed using the
// associated format, then we return NULL. The caller is responsible for
// calling unref() on the returned data.
- SkData* CompressBitmapToFormat(const SkPixmap&, Format format);
+ SkData* CompressBitmapToFormat(const SkBitmap& bitmap, Format format);
// Compresses the given src data into dst. The src data is assumed to be
// large enough to hold width*height pixels. The dst data is expected to
diff --git a/src/utils/SkTextureCompressor_Blitter.h b/src/utils/SkTextureCompressor_Blitter.h
index e522375..73d8ee4 100644
--- a/src/utils/SkTextureCompressor_Blitter.h
+++ b/src/utils/SkTextureCompressor_Blitter.h
@@ -368,7 +368,7 @@
// If the blitter just sets a single value for each pixel, return the
// bitmap it draws into, and assign value. If not, return NULL and ignore
// the value parameter.
- const SkPixmap* justAnOpaqueColor(uint32_t* value) override {
+ const SkBitmap* justAnOpaqueColor(uint32_t* value) override {
return NULL;
}