Index: src/core/SkOrderedReadBuffer.cpp |
diff --git a/src/core/SkOrderedReadBuffer.cpp b/src/core/SkOrderedReadBuffer.cpp |
index e8250ddfa3560108a033da2bd838863aeab36b17..9d991949084e5b9586d57baeaadf72363eb3e3ef 100644 |
--- a/src/core/SkOrderedReadBuffer.cpp |
+++ b/src/core/SkOrderedReadBuffer.cpp |
@@ -23,6 +23,9 @@ SkOrderedReadBuffer::SkOrderedReadBuffer() : INHERITED() { |
fFactoryArray = NULL; |
fFactoryCount = 0; |
fBitmapDecoder = NULL; |
+#ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
+ fDecodedBitmapIndex = -1; |
+#endif // DEBUG_NON_DETERMINISTIC_ASSERT |
} |
SkOrderedReadBuffer::SkOrderedReadBuffer(const void* data, size_t size) : INHERITED() { |
@@ -37,6 +40,9 @@ SkOrderedReadBuffer::SkOrderedReadBuffer(const void* data, size_t size) : INHERI |
fFactoryArray = NULL; |
fFactoryCount = 0; |
fBitmapDecoder = NULL; |
+#ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
+ fDecodedBitmapIndex = -1; |
+#endif // DEBUG_NON_DETERMINISTIC_ASSERT |
} |
SkOrderedReadBuffer::SkOrderedReadBuffer(SkStream* stream) { |
@@ -53,6 +59,9 @@ SkOrderedReadBuffer::SkOrderedReadBuffer(SkStream* stream) { |
fFactoryArray = NULL; |
fFactoryCount = 0; |
fBitmapDecoder = NULL; |
+#ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
+ fDecodedBitmapIndex = -1; |
+#endif // DEBUG_NON_DETERMINISTIC_ASSERT |
} |
SkOrderedReadBuffer::~SkOrderedReadBuffer() { |
@@ -192,6 +201,9 @@ void SkOrderedReadBuffer::readBitmap(SkBitmap* bitmap) { |
// The writer stored false, meaning the SkBitmap was not stored in an SkBitmapHeap. |
const size_t length = this->readUInt(); |
if (length > 0) { |
+#ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
+ fDecodedBitmapIndex++; |
+#endif // DEBUG_NON_DETERMINISTIC_ASSERT |
// A non-zero size means the SkBitmap was encoded. Read the data and pixel |
// offset. |
const void* data = this->skip(length); |
@@ -199,6 +211,16 @@ void SkOrderedReadBuffer::readBitmap(SkBitmap* bitmap) { |
const int32_t yOffset = fReader.readS32(); |
if (fBitmapDecoder != NULL && fBitmapDecoder(data, length, bitmap)) { |
if (bitmap->width() == width && bitmap->height() == height) { |
+#ifdef DEBUG_NON_DETERMINISTIC_ASSERT |
+ if (0 != xOffset || 0 != yOffset) { |
+ SkDebugf("SkOrderedReadBuffer::readBitmap: heights match," |
+ " but offset is not zero. \nInfo about the bitmap:" |
+ "\n\tIndex: %d\n\tDimensions: [%d %d]\n\tEncoded" |
+ " data size: %d\n\tOffset: (%d, %d)\n", |
+ fDecodedBitmapIndex, width, height, length, xOffset, |
+ yOffset); |
+ } |
+#endif // DEBUG_NON_DETERMINISTIC_ASSERT |
// If the width and height match, there should be no offset. |
SkASSERT(0 == xOffset && 0 == yOffset); |
return; |