guard old apis for querying byte-size of a bitmap/imageinfo/pixmap
Previously we had size_t and uint64_t variations.
The new (simpler) API always..
- returns size_t, or 0 if the calculation overflowed
- returns the trimmed size (does not include rowBytes padding for the last row)
Bug: skia:
Change-Id: I05173e877918327c7b207d2f7f1ab0db36892e2e
Reviewed-on: https://skia-review.googlesource.com/50980
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 2a0b598..0968aca 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -454,7 +454,7 @@
const int bpp = SkColorTypeBytesPerPixel(decodeInfo.colorType());
const size_t rowBytes = size.width() * bpp;
- const size_t safeSize = decodeInfo.getSafeSize(rowBytes);
+ const size_t safeSize = decodeInfo.computeByteSize(rowBytes);
SkAutoMalloc pixels(safeSize);
SkCodec::Options options;
@@ -1468,12 +1468,12 @@
static Error compare_bitmaps(const SkBitmap& reference, const SkBitmap& bitmap) {
// The dimensions are a property of the Src only, and so should be identical.
- SkASSERT(reference.getSize() == bitmap.getSize());
- if (reference.getSize() != bitmap.getSize()) {
+ SkASSERT(reference.computeByteSize() == bitmap.computeByteSize());
+ if (reference.computeByteSize() != bitmap.computeByteSize()) {
return "Dimensions don't match reference";
}
// All SkBitmaps in DM are tight, so this comparison is easy.
- if (0 != memcmp(reference.getPixels(), bitmap.getPixels(), reference.getSize())) {
+ if (0 != memcmp(reference.getPixels(), bitmap.getPixels(), reference.computeByteSize())) {
SkString encoded;
SkString errString("Pixels don't match reference");
if (encode_png_base64(reference, &encoded)) {