diff options
author | 2013-01-15 20:17:47 +0000 | |
---|---|---|
committer | 2013-01-15 20:17:47 +0000 | |
commit | 76f9e938df0b5826fd4c80b854ceafaf385cfbe1 (patch) | |
tree | 5e72265c6e177791a1fff149763308454c958429 /src/core/SkBitmap.cpp | |
parent | 06b8a19b5693a352cabe8e624469e67e335bc369 (diff) |
Added print out of SkShader information to debugger
https://codereview.appspot.com/7105045/
git-svn-id: http://skia.googlecode.com/svn/trunk@7201 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r-- | src/core/SkBitmap.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index f0dafc17fa..9692a71be2 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -1638,3 +1638,44 @@ void SkBitmap::validate() const { #endif } #endif + +#ifdef SK_DEVELOPER +void SkBitmap::toString(SkString* str) const { + + static const char* gConfigNames[kConfigCount] = { + "NONE", "A1", "A8", "INDEX8", "565", "4444", "8888", "RLE" + }; + + str->appendf("bitmap: ((%d, %d) %s", this->width(), this->height(), + gConfigNames[this->config()]); + + str->append(" ("); + if (this->isOpaque()) { + str->append("opaque"); + } else { + str->append("transparent"); + } + if (this->isImmutable()) { + str->append(", immutable"); + } else { + str->append(", not-immutable"); + } + str->append(")"); + + SkPixelRef* pr = this->pixelRef(); + if (NULL == pr) { + // show null or the explicit pixel address (rare) + str->appendf(" pixels:%p", this->getPixels()); + } else { + const char* uri = pr->getURI(); + if (NULL != uri) { + str->appendf(" uri:\"%s\"", uri); + } else { + str->appendf(" pixelref:%p", pr); + } + } + + str->append(")"); +} +#endif + |