Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: src/core/SkOrderedReadBuffer.cpp

Issue 18523008: Debugging statements to investigate a bug. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkOrderedReadBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/core/SkOrderedReadBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698