OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "SkDumpCanvas.h" | 9 #include "SkDumpCanvas.h" |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 "POINTS", "LINES", "POLYGON" | 135 "POINTS", "LINES", "POLYGON" |
136 }; | 136 }; |
137 return gPMNames[pm]; | 137 return gPMNames[pm]; |
138 } | 138 } |
139 | 139 |
140 static void toString(const void* text, size_t byteLen, SkPaint::TextEncoding enc
, | 140 static void toString(const void* text, size_t byteLen, SkPaint::TextEncoding enc
, |
141 SkString* str) { | 141 SkString* str) { |
142 // FIXME: this code appears to be untested - and probably unused - and proba
bly wrong | 142 // FIXME: this code appears to be untested - and probably unused - and proba
bly wrong |
143 switch (enc) { | 143 switch (enc) { |
144 case SkPaint::kUTF8_TextEncoding: | 144 case SkPaint::kUTF8_TextEncoding: |
145 str->appendf("\"%.*s\"%s", SkMax32(byteLen, 32), (const char*) text, | 145 str->appendf("\"%.*s\"%s", SkTMax<size_t>(byteLen, 32), (const char*
) text, |
146 byteLen > 32 ? "..." : ""); | 146 byteLen > 32 ? "..." : ""); |
147 break; | 147 break; |
148 case SkPaint::kUTF16_TextEncoding: | 148 case SkPaint::kUTF16_TextEncoding: |
149 str->appendf("\"%.*ls\"%s", SkMax32(byteLen, 32), (const wchar_t*) t
ext, | 149 str->appendf("\"%.*ls\"%s", SkTMax<size_t>(byteLen, 32), (const wcha
r_t*) text, |
150 byteLen > 64 ? "..." : ""); | 150 byteLen > 64 ? "..." : ""); |
151 break; | 151 break; |
152 case SkPaint::kUTF32_TextEncoding: | 152 case SkPaint::kUTF32_TextEncoding: |
153 str->appendf("\"%.*ls\"%s", SkMax32(byteLen, 32), (const wchar_t*) t
ext, | 153 str->appendf("\"%.*ls\"%s", SkTMax<size_t>(byteLen, 32), (const wcha
r_t*) text, |
154 byteLen > 128 ? "..." : ""); | 154 byteLen > 128 ? "..." : ""); |
155 break; | 155 break; |
156 case SkPaint::kGlyphID_TextEncoding: | 156 case SkPaint::kGlyphID_TextEncoding: |
157 str->append("<glyphs>"); | 157 str->append("<glyphs>"); |
158 break; | 158 break; |
159 | 159 |
160 default: | 160 default: |
161 SkASSERT(false); | 161 SkASSERT(false); |
162 break; | 162 break; |
163 } | 163 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 const uint16_t indices[], int indexCount, | 437 const uint16_t indices[], int indexCount, |
438 const SkPaint& paint) { | 438 const SkPaint& paint) { |
439 this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)", | 439 this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)", |
440 toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX), | 440 toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX), |
441 SkScalarToFloat(vertices[0].fY)); | 441 SkScalarToFloat(vertices[0].fY)); |
442 } | 442 } |
443 | 443 |
444 void SkDumpCanvas::drawData(const void* data, size_t length) { | 444 void SkDumpCanvas::drawData(const void* data, size_t length) { |
445 // this->dump(kDrawData_Verb, NULL, "drawData(%d)", length); | 445 // this->dump(kDrawData_Verb, NULL, "drawData(%d)", length); |
446 this->dump(kDrawData_Verb, NULL, "drawData(%d) %.*s", length, | 446 this->dump(kDrawData_Verb, NULL, "drawData(%d) %.*s", length, |
447 SkMin32(length, 64), data); | 447 SkTMin<size_t>(length, 64), data); |
448 } | 448 } |
449 | 449 |
450 void SkDumpCanvas::beginCommentGroup(const char* description) { | 450 void SkDumpCanvas::beginCommentGroup(const char* description) { |
451 this->dump(kBeginCommentGroup_Verb, NULL, "beginCommentGroup(%s)", descripti
on); | 451 this->dump(kBeginCommentGroup_Verb, NULL, "beginCommentGroup(%s)", descripti
on); |
452 } | 452 } |
453 | 453 |
454 void SkDumpCanvas::addComment(const char* kywd, const char* value) { | 454 void SkDumpCanvas::addComment(const char* kywd, const char* value) { |
455 this->dump(kAddComment_Verb, NULL, "addComment(%s, %s)", kywd, value); | 455 this->dump(kAddComment_Verb, NULL, "addComment(%s, %s)", kywd, value); |
456 } | 456 } |
457 | 457 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 518 |
519 /////////////////////////////////////////////////////////////////////////////// | 519 /////////////////////////////////////////////////////////////////////////////// |
520 | 520 |
521 static void dumpToDebugf(const char text[], void*) { | 521 static void dumpToDebugf(const char text[], void*) { |
522 SkDebugf("%s\n", text); | 522 SkDebugf("%s\n", text); |
523 } | 523 } |
524 | 524 |
525 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} | 525 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} |
526 | 526 |
527 #endif | 527 #endif |
OLD | NEW |