Debugging statements to investigate a bug.
https://code.google.com/p/skia/issues/detail?id=1395 is a non-
deterministic bug that I have been unable to reproduce. Add
some debugging information to try to help diagnose.
BUG=https://code.google.com/p/skia/issues/detail?id=1395
R=edisonn@google.com
Review URL: https://codereview.chromium.org/18523008
git-svn-id: http://skia.googlecode.com/svn/trunk@9914 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkOrderedReadBuffer.cpp b/src/core/SkOrderedReadBuffer.cpp
index e8250dd..9d99194 100644
--- a/src/core/SkOrderedReadBuffer.cpp
+++ b/src/core/SkOrderedReadBuffer.cpp
@@ -23,6 +23,9 @@
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 @@
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 @@
fFactoryArray = NULL;
fFactoryCount = 0;
fBitmapDecoder = NULL;
+#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
+ fDecodedBitmapIndex = -1;
+#endif // DEBUG_NON_DETERMINISTIC_ASSERT
}
SkOrderedReadBuffer::~SkOrderedReadBuffer() {
@@ -192,6 +201,9 @@
// 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 @@
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;