| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkObjectParser.h" | 9 #include "SkObjectParser.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| 11 #include "SkFontDescriptor.h" | 11 #include "SkFontDescriptor.h" |
| 12 #include "SkImage.h" | 12 #include "SkImage.h" |
| 13 #include "SkPath.h" | 13 #include "SkPath.h" |
| 14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
| 15 #include "SkShader.h" | 15 #include "SkShader.h" |
| 16 #include "SkStream.h" | 16 #include "SkStream.h" |
| 17 #include "SkStringUtils.h" | 17 #include "SkStringUtils.h" |
| 18 #include "SkTypeface.h" | 18 #include "SkTypeface.h" |
| 19 #include "SkUtils.h" | 19 #include "SkUtils.h" |
| 20 | 20 |
| 21 /* TODO(chudy): Replace all std::strings with char */ | 21 /* TODO(chudy): Replace all std::strings with char */ |
| 22 | 22 |
| 23 SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { | 23 SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { |
| 24 SkString* mBitmap = new SkString("SkBitmap: "); | 24 SkString* mBitmap = new SkString("SkBitmap: "); |
| 25 mBitmap->append("W: "); | 25 mBitmap->append("W: "); |
| 26 mBitmap->appendS32(bitmap.width()); | 26 mBitmap->appendS32(bitmap.width()); |
| 27 mBitmap->append(" H: "); | 27 mBitmap->append(" H: "); |
| 28 mBitmap->appendS32(bitmap.height()); | 28 mBitmap->appendS32(bitmap.height()); |
| 29 | 29 |
| 30 const char* gColorTypeStrings[] = { | 30 const char* gColorTypeStrings[] = { |
| 31 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8", "RGBAf16" | 31 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8" |
| 32 }; | 32 }; |
| 33 static_assert(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)
, | 33 SkASSERT(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)); |
| 34 "colortype names do not match colortype enum"); | |
| 35 | 34 |
| 36 mBitmap->append(" ColorType: "); | 35 mBitmap->append(" ColorType: "); |
| 37 mBitmap->append(gColorTypeStrings[bitmap.colorType()]); | 36 mBitmap->append(gColorTypeStrings[bitmap.colorType()]); |
| 38 | 37 |
| 39 if (bitmap.isOpaque()) { | 38 if (bitmap.isOpaque()) { |
| 40 mBitmap->append(" opaque"); | 39 mBitmap->append(" opaque"); |
| 41 } else { | 40 } else { |
| 42 mBitmap->append(" not-opaque"); | 41 mBitmap->append(" not-opaque"); |
| 43 } | 42 } |
| 44 | 43 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 } | 396 } |
| 398 break; | 397 break; |
| 399 } | 398 } |
| 400 default: | 399 default: |
| 401 decodedText->append("Unknown text encoding."); | 400 decodedText->append("Unknown text encoding."); |
| 402 break; | 401 break; |
| 403 } | 402 } |
| 404 | 403 |
| 405 return decodedText; | 404 return decodedText; |
| 406 } | 405 } |
| OLD | NEW |