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
This commit is contained in:
parent
ba7ef37a04
commit
c6e5fcb4c4
@ -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;
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
class SkBitmap;
|
||||
|
||||
#if defined(SK_DEBUG) && defined(SK_BUILD_FOR_MAC)
|
||||
#define DEBUG_NON_DETERMINISTIC_ASSERT
|
||||
#endif
|
||||
|
||||
class SkOrderedReadBuffer : public SkFlattenableReadBuffer {
|
||||
public:
|
||||
SkOrderedReadBuffer();
|
||||
@ -122,6 +126,12 @@ private:
|
||||
|
||||
SkPicture::InstallPixelRefProc fBitmapDecoder;
|
||||
|
||||
#ifdef DEBUG_NON_DETERMINISTIC_ASSERT
|
||||
// Debugging counter to keep track of how many bitmaps we
|
||||
// have decoded.
|
||||
int fDecodedBitmapIndex;
|
||||
#endif // DEBUG_NON_DETERMINISTIC_ASSERT
|
||||
|
||||
typedef SkFlattenableReadBuffer INHERITED;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user