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" | 31 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8", "RGBAf16" |
32 }; | 32 }; |
33 SkASSERT(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)); | 33 static_assert(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)
, |
| 34 "colortype names do not match colortype enum"); |
34 | 35 |
35 mBitmap->append(" ColorType: "); | 36 mBitmap->append(" ColorType: "); |
36 mBitmap->append(gColorTypeStrings[bitmap.colorType()]); | 37 mBitmap->append(gColorTypeStrings[bitmap.colorType()]); |
37 | 38 |
38 if (bitmap.isOpaque()) { | 39 if (bitmap.isOpaque()) { |
39 mBitmap->append(" opaque"); | 40 mBitmap->append(" opaque"); |
40 } else { | 41 } else { |
41 mBitmap->append(" not-opaque"); | 42 mBitmap->append(" not-opaque"); |
42 } | 43 } |
43 | 44 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 397 } |
397 break; | 398 break; |
398 } | 399 } |
399 default: | 400 default: |
400 decodedText->append("Unknown text encoding."); | 401 decodedText->append("Unknown text encoding."); |
401 break; | 402 break; |
402 } | 403 } |
403 | 404 |
404 return decodedText; | 405 return decodedText; |
405 } | 406 } |
OLD | NEW |