OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
4 * | 3 * |
5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 #include "SkObjectParser.h" | 8 #include "SkObjectParser.h" |
10 #include "SkData.h" | 9 #include "SkData.h" |
11 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
12 #include "SkImage.h" | 11 #include "SkImage.h" |
13 #include "SkPath.h" | 12 #include "SkPath.h" |
14 #include "SkRRect.h" | 13 #include "SkRRect.h" |
15 #include "SkShader.h" | 14 #include "SkShader.h" |
16 #include "SkStream.h" | 15 #include "SkStream.h" |
17 #include "SkStringUtils.h" | 16 #include "SkStringUtils.h" |
18 #include "SkTypeface.h" | 17 #include "SkTypeface.h" |
19 #include "SkUtils.h" | 18 #include "SkUtils.h" |
20 | 19 |
21 /* TODO(chudy): Replace all std::strings with char */ | 20 /* TODO(chudy): Replace all std::strings with char */ |
22 | 21 |
23 SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { | 22 SkString* SkObjectParser::BitmapToString(const SkBitmap& bitmap) { |
24 SkString* mBitmap = new SkString("SkBitmap: "); | 23 SkString* mBitmap = new SkString("SkBitmap: "); |
25 mBitmap->append("W: "); | 24 mBitmap->append("W: "); |
26 mBitmap->appendS32(bitmap.width()); | 25 mBitmap->appendS32(bitmap.width()); |
27 mBitmap->append(" H: "); | 26 mBitmap->append(" H: "); |
28 mBitmap->appendS32(bitmap.height()); | 27 mBitmap->appendS32(bitmap.height()); |
29 | 28 |
30 const char* gColorTypeStrings[] = { | 29 const char* gColorTypeStrings[] = { |
31 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8", "RGBAf16" | 30 "None", "A8", "565", "4444", "RGBA", "BGRA", "Index8", "G8", "RGBAf16" |
32 }; | 31 }; |
33 static_assert(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)
, | 32 static_assert(kLastEnum_SkColorType + 1 == SK_ARRAY_COUNT(gColorTypeStrings)
, |
34 "colortype names do not match colortype enum"); | 33 "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()) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 SkString* SkObjectParser::PaintToString(const SkPaint& paint) { | 128 SkString* SkObjectParser::PaintToString(const SkPaint& paint) { |
130 SkString* str = new SkString; | 129 SkString* str = new SkString; |
131 #ifndef SK_IGNORE_TO_STRING | 130 #ifndef SK_IGNORE_TO_STRING |
132 paint.toString(str); | 131 paint.toString(str); |
133 #endif | 132 #endif |
134 return str; | 133 return str; |
135 } | 134 } |
136 | 135 |
137 SkString* SkObjectParser::PathToString(const SkPath& path) { | 136 SkString* SkObjectParser::PathToString(const SkPath& path) { |
138 SkString* mPath = new SkString; | 137 SkString* mPath = new SkString; |
139 | 138 |
140 mPath->appendf("Path (%d) (", path.getGenerationID()); | 139 mPath->appendf("Path (%d) (", path.getGenerationID()); |
141 | 140 |
142 static const char* gFillStrings[] = { | 141 static const char* gFillStrings[] = { |
143 "Winding", "EvenOdd", "InverseWinding", "InverseEvenOdd" | 142 "Winding", "EvenOdd", "InverseWinding", "InverseEvenOdd" |
144 }; | 143 }; |
145 | 144 |
146 mPath->append(gFillStrings[path.getFillType()]); | 145 mPath->append(gFillStrings[path.getFillType()]); |
147 mPath->append(", "); | 146 mPath->append(", "); |
148 | 147 |
149 static const char* gConvexityStrings[] = { | 148 static const char* gConvexityStrings[] = { |
(...skipping 247 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 |