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