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 "SkRRect.h" | 12 #include "SkRRect.h" |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 #include "SkStringUtils.h" | 15 #include "SkStringUtils.h" |
16 #include "SkTypeface.h" | 16 #include "SkTypeface.h" |
17 #include "SkUtils.h" | 17 #include "SkUtils.h" |
18 | 18 |
19 /* TODO(chudy): Replace all std::strings with char */ | 19 /* TODO(chudy): Replace all std::strings with char */ |
20 | 20 |
21 SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { | 21 SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { |
22 SkString* mBitmap = new SkString("SkBitmap: "); | 22 SkString* mBitmap = new SkString("SkBitmap: "); |
23 mBitmap->append("W: "); | 23 mBitmap->append("W: "); |
24 mBitmap->appendS32(bitmap.width()); | 24 mBitmap->appendS32(bitmap.width()); |
25 mBitmap->append(" H: "); | 25 mBitmap->append(" H: "); |
26 mBitmap->appendS32(bitmap.height()); | 26 mBitmap->appendS32(bitmap.height()); |
27 | 27 |
28 const char* gColorTypeStrings[] = { | 28 const char* gColorTypeStrings[] = { |
29 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8" | 29 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8" |
30 }; | 30 }; |
31 SkASSERT(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)); | 31 SkASSERT(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)); |
32 | 32 |
33 mBitmap->append(" ColorType: "); | 33 mBitmap->append(" ColorType: "); |
34 mBitmap->append(gColorTypeStrings[bitmap.colorType()]); | 34 mBitmap->append(gColorTypeStrings[bitmap.colorType()]); |
35 | 35 |
36 if (bitmap.isOpaque()) { | 36 if (bitmap.isOpaque()) { |
37 mBitmap->append(" opaque"); | 37 mBitmap->append(" opaque"); |
38 } else { | 38 } else { |
39 mBitmap->append(" not-opaque"); | 39 mBitmap->append(" not-opaque"); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 359 } |
360 break; | 360 break; |
361 } | 361 } |
362 default: | 362 default: |
363 decodedText->append("Unknown text encoding."); | 363 decodedText->append("Unknown text encoding."); |
364 break; | 364 break; |
365 } | 365 } |
366 | 366 |
367 return decodedText; | 367 return decodedText; |
368 } | 368 } |
OLD | NEW |