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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 | 382 |
383 void SkDumpCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, | 383 void SkDumpCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, |
384 const SkPaint* paint) { | 384 const SkPaint* paint) { |
385 SkString str; | 385 SkString str; |
386 bitmap.toString(&str); | 386 bitmap.toString(&str); |
387 this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(), | 387 this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(), |
388 x, y); | 388 x, y); |
389 } | 389 } |
390 | 390 |
391 void SkDumpCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, S
kScalar y, | 391 void SkDumpCanvas::drawText(const void* text, size_t byteLength, SkScalar x, |
392 const SkPaint& paint) { | 392 SkScalar y, const SkPaint& paint) { |
393 SkString str; | 393 SkString str; |
394 toString(text, byteLength, paint.getTextEncoding(), &str); | 394 toString(text, byteLength, paint.getTextEncoding(), &str); |
395 this->dump(kDrawText_Verb, &paint, "drawText(%s [%d] %g %g)", str.c_str(), | 395 this->dump(kDrawText_Verb, &paint, "drawText(%s [%d] %g %g)", str.c_str(), |
396 byteLength, SkScalarToFloat(x), SkScalarToFloat(y)); | 396 byteLength, SkScalarToFloat(x), SkScalarToFloat(y)); |
397 } | 397 } |
398 | 398 |
399 void SkDumpCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPo
int pos[], | 399 void SkDumpCanvas::drawPosText(const void* text, size_t byteLength, |
400 const SkPaint& paint) { | 400 const SkPoint pos[], const SkPaint& paint) { |
401 SkString str; | 401 SkString str; |
402 toString(text, byteLength, paint.getTextEncoding(), &str); | 402 toString(text, byteLength, paint.getTextEncoding(), &str); |
403 this->dump(kDrawText_Verb, &paint, "drawPosText(%s [%d] %g %g ...)", | 403 this->dump(kDrawText_Verb, &paint, "drawPosText(%s [%d] %g %g ...)", |
404 str.c_str(), byteLength, SkScalarToFloat(pos[0].fX), | 404 str.c_str(), byteLength, SkScalarToFloat(pos[0].fX), |
405 SkScalarToFloat(pos[0].fY)); | 405 SkScalarToFloat(pos[0].fY)); |
406 } | 406 } |
407 | 407 |
408 void SkDumpCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkS
calar xpos[], | 408 void SkDumpCanvas::drawPosTextH(const void* text, size_t byteLength, |
409 SkScalar constY, const SkPaint& paint) { | 409 const SkScalar xpos[], SkScalar constY, |
| 410 const SkPaint& paint) { |
410 SkString str; | 411 SkString str; |
411 toString(text, byteLength, paint.getTextEncoding(), &str); | 412 toString(text, byteLength, paint.getTextEncoding(), &str); |
412 this->dump(kDrawText_Verb, &paint, "drawPosTextH(%s [%d] %g %g ...)", | 413 this->dump(kDrawText_Verb, &paint, "drawPosTextH(%s [%d] %g %g ...)", |
413 str.c_str(), byteLength, SkScalarToFloat(xpos[0]), | 414 str.c_str(), byteLength, SkScalarToFloat(xpos[0]), |
414 SkScalarToFloat(constY)); | 415 SkScalarToFloat(constY)); |
415 } | 416 } |
416 | 417 |
417 void SkDumpCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const S
kPath& path, | 418 void SkDumpCanvas::drawTextOnPath(const void* text, size_t byteLength, |
418 const SkMatrix* matrix, const SkPaint& paint
) { | 419 const SkPath& path, const SkMatrix* matrix, |
| 420 const SkPaint& paint) { |
419 SkString str; | 421 SkString str; |
420 toString(text, byteLength, paint.getTextEncoding(), &str); | 422 toString(text, byteLength, paint.getTextEncoding(), &str); |
421 this->dump(kDrawText_Verb, &paint, "drawTextOnPath(%s [%d])", | 423 this->dump(kDrawText_Verb, &paint, "drawTextOnPath(%s [%d])", |
422 str.c_str(), byteLength); | 424 str.c_str(), byteLength); |
423 } | 425 } |
424 | 426 |
425 void SkDumpCanvas::drawPicture(SkPicture& picture) { | 427 void SkDumpCanvas::drawPicture(SkPicture& picture) { |
426 this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", &picture, | 428 this->dump(kDrawPicture_Verb, NULL, "drawPicture(%p) %d:%d", &picture, |
427 picture.width(), picture.height()); | 429 picture.width(), picture.height()); |
428 fNestLevel += 1; | 430 fNestLevel += 1; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 521 |
520 /////////////////////////////////////////////////////////////////////////////// | 522 /////////////////////////////////////////////////////////////////////////////// |
521 | 523 |
522 static void dumpToDebugf(const char text[], void*) { | 524 static void dumpToDebugf(const char text[], void*) { |
523 SkDebugf("%s\n", text); | 525 SkDebugf("%s\n", text); |
524 } | 526 } |
525 | 527 |
526 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} | 528 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} |
527 | 529 |
528 #endif | 530 #endif |
OLD | NEW |