| 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" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 mPath->append(", "); | 144 mPath->append(", "); |
| 145 | 145 |
| 146 static const char* gConvexityStrings[] = { | 146 static const char* gConvexityStrings[] = { |
| 147 "Unknown", "Convex", "Concave" | 147 "Unknown", "Convex", "Concave" |
| 148 }; | 148 }; |
| 149 SkASSERT(SkPath::kConcave_Convexity == 2); | 149 SkASSERT(SkPath::kConcave_Convexity == 2); |
| 150 | 150 |
| 151 mPath->append(gConvexityStrings[path.getConvexity()]); | 151 mPath->append(gConvexityStrings[path.getConvexity()]); |
| 152 mPath->append(", "); | 152 mPath->append(", "); |
| 153 | 153 |
| 154 if (path.isRect(NULL)) { | 154 if (path.isRect(nullptr)) { |
| 155 mPath->append("isRect, "); | 155 mPath->append("isRect, "); |
| 156 } else { | 156 } else { |
| 157 mPath->append("isNotRect, "); | 157 mPath->append("isNotRect, "); |
| 158 } | 158 } |
| 159 | 159 |
| 160 mPath->appendS32(path.countVerbs()); | 160 mPath->appendS32(path.countVerbs()); |
| 161 mPath->append("V, "); | 161 mPath->append("V, "); |
| 162 mPath->appendS32(path.countPoints()); | 162 mPath->appendS32(path.countPoints()); |
| 163 mPath->append("P): "); | 163 mPath->append("P): "); |
| 164 | 164 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } else if (mode == SkCanvas::kPolygon_PointMode) { | 228 } else if (mode == SkCanvas::kPolygon_PointMode) { |
| 229 mMode->append("kPolygon_PointMode"); | 229 mMode->append("kPolygon_PointMode"); |
| 230 } | 230 } |
| 231 return mMode; | 231 return mMode; |
| 232 } | 232 } |
| 233 | 233 |
| 234 SkString* SkObjectParser::RectToString(const SkRect& rect, const char* title) { | 234 SkString* SkObjectParser::RectToString(const SkRect& rect, const char* title) { |
| 235 | 235 |
| 236 SkString* mRect = new SkString; | 236 SkString* mRect = new SkString; |
| 237 | 237 |
| 238 if (NULL == title) { | 238 if (nullptr == title) { |
| 239 mRect->append("SkRect: "); | 239 mRect->append("SkRect: "); |
| 240 } else { | 240 } else { |
| 241 mRect->append(title); | 241 mRect->append(title); |
| 242 } | 242 } |
| 243 mRect->append("("); | 243 mRect->append("("); |
| 244 mRect->appendScalar(rect.left()); | 244 mRect->appendScalar(rect.left()); |
| 245 mRect->append(", "); | 245 mRect->append(", "); |
| 246 mRect->appendScalar(rect.top()); | 246 mRect->appendScalar(rect.top()); |
| 247 mRect->append(", "); | 247 mRect->append(", "); |
| 248 mRect->appendScalar(rect.right()); | 248 mRect->appendScalar(rect.right()); |
| 249 mRect->append(", "); | 249 mRect->append(", "); |
| 250 mRect->appendScalar(rect.bottom()); | 250 mRect->appendScalar(rect.bottom()); |
| 251 mRect->append(")"); | 251 mRect->append(")"); |
| 252 return mRect; | 252 return mRect; |
| 253 } | 253 } |
| 254 | 254 |
| 255 SkString* SkObjectParser::RRectToString(const SkRRect& rrect, const char* title)
{ | 255 SkString* SkObjectParser::RRectToString(const SkRRect& rrect, const char* title)
{ |
| 256 | 256 |
| 257 SkString* mRRect = new SkString; | 257 SkString* mRRect = new SkString; |
| 258 | 258 |
| 259 if (NULL == title) { | 259 if (nullptr == title) { |
| 260 mRRect->append("SkRRect ("); | 260 mRRect->append("SkRRect ("); |
| 261 if (rrect.isEmpty()) { | 261 if (rrect.isEmpty()) { |
| 262 mRRect->append("empty"); | 262 mRRect->append("empty"); |
| 263 } else if (rrect.isRect()) { | 263 } else if (rrect.isRect()) { |
| 264 mRRect->append("rect"); | 264 mRRect->append("rect"); |
| 265 } else if (rrect.isOval()) { | 265 } else if (rrect.isOval()) { |
| 266 mRRect->append("oval"); | 266 mRRect->append("oval"); |
| 267 } else if (rrect.isSimple()) { | 267 } else if (rrect.isSimple()) { |
| 268 mRRect->append("simple"); | 268 mRRect->append("simple"); |
| 269 } else if (rrect.isNinePatch()) { | 269 } else if (rrect.isNinePatch()) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 switch (encoding) { | 351 switch (encoding) { |
| 352 case SkPaint::kUTF8_TextEncoding: { | 352 case SkPaint::kUTF8_TextEncoding: { |
| 353 decodedText->append("UTF-8: "); | 353 decodedText->append("UTF-8: "); |
| 354 decodedText->append((const char*)text, byteLength); | 354 decodedText->append((const char*)text, byteLength); |
| 355 break; | 355 break; |
| 356 } | 356 } |
| 357 case SkPaint::kUTF16_TextEncoding: { | 357 case SkPaint::kUTF16_TextEncoding: { |
| 358 decodedText->append("UTF-16: "); | 358 decodedText->append("UTF-16: "); |
| 359 size_t sizeNeeded = SkUTF16_ToUTF8((uint16_t*)text, | 359 size_t sizeNeeded = SkUTF16_ToUTF8((uint16_t*)text, |
| 360 SkToS32(byteLength / 2), | 360 SkToS32(byteLength / 2), |
| 361 NULL); | 361 nullptr); |
| 362 SkAutoSTMalloc<0x100, char> utf8(sizeNeeded); | 362 SkAutoSTMalloc<0x100, char> utf8(sizeNeeded); |
| 363 SkUTF16_ToUTF8((uint16_t*)text, SkToS32(byteLength / 2), utf8); | 363 SkUTF16_ToUTF8((uint16_t*)text, SkToS32(byteLength / 2), utf8); |
| 364 decodedText->append(utf8, sizeNeeded); | 364 decodedText->append(utf8, sizeNeeded); |
| 365 break; | 365 break; |
| 366 } | 366 } |
| 367 case SkPaint::kUTF32_TextEncoding: { | 367 case SkPaint::kUTF32_TextEncoding: { |
| 368 decodedText->append("UTF-32: "); | 368 decodedText->append("UTF-32: "); |
| 369 const SkUnichar* begin = (const SkUnichar*)text; | 369 const SkUnichar* begin = (const SkUnichar*)text; |
| 370 const SkUnichar* end = (const SkUnichar*)((const char*)text + byteLe
ngth); | 370 const SkUnichar* end = (const SkUnichar*)((const char*)text + byteLe
ngth); |
| 371 for (const SkUnichar* unichar = begin; unichar < end; ++unichar) { | 371 for (const SkUnichar* unichar = begin; unichar < end; ++unichar) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 384 } | 384 } |
| 385 break; | 385 break; |
| 386 } | 386 } |
| 387 default: | 387 default: |
| 388 decodedText->append("Unknown text encoding."); | 388 decodedText->append("Unknown text encoding."); |
| 389 break; | 389 break; |
| 390 } | 390 } |
| 391 | 391 |
| 392 return decodedText; | 392 return decodedText; |
| 393 } | 393 } |
| OLD | NEW |