aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r--src/core/SkBitmap.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 91510007cf..579573367f 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -633,6 +633,33 @@ void SkBitmap::validate() const {
}
#endif
+#include "SkString.h"
+void SkBitmap::toString(SkString* str) const {
+
+ static const char* gColorTypeNames[kLastEnum_SkColorType + 1] = {
+ "UNKNOWN", "A8", "565", "4444", "RGBA", "BGRA", "INDEX8",
+ };
+
+ str->appendf("bitmap: ((%d, %d) %s", this->width(), this->height(),
+ gColorTypeNames[this->colorType()]);
+
+ 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(")");
+
+ str->appendf(" pixelref:%p", this->pixelRef());
+ str->append(")");
+}
+
///////////////////////////////////////////////////////////////////////////////
bool SkBitmap::peekPixels(SkPixmap* pmap) const {