| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 void SkDumpCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, | 340 void SkDumpCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, |
| 341 const SkPaint* paint) { | 341 const SkPaint* paint) { |
| 342 SkString str; | 342 SkString str; |
| 343 bitmap.toString(&str); | 343 bitmap.toString(&str); |
| 344 this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(), | 344 this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(), |
| 345 SkScalarToFloat(x), SkScalarToFloat(y)); | 345 SkScalarToFloat(x), SkScalarToFloat(y)); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void SkDumpCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, | 348 void SkDumpCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, |
| 349 const SkPaint* paint, DrawBitmapRectFlags fl
ags) { | 349 const SkPaint* paint, SK_VIRTUAL_CONSTRAINT_
TYPE) { |
| 350 SkString bs, rs; | 350 SkString bs, rs; |
| 351 bitmap.toString(&bs); | 351 bitmap.toString(&bs); |
| 352 toString(dst, &rs); | 352 toString(dst, &rs); |
| 353 // show the src-rect only if its not everything | 353 // show the src-rect only if its not everything |
| 354 if (src && (src->fLeft > 0 || src->fTop > 0 || | 354 if (src && (src->fLeft > 0 || src->fTop > 0 || |
| 355 src->fRight < SkIntToScalar(bitmap.width()) || | 355 src->fRight < SkIntToScalar(bitmap.width()) || |
| 356 src->fBottom < SkIntToScalar(bitmap.height()))) { | 356 src->fBottom < SkIntToScalar(bitmap.height()))) { |
| 357 SkString ss; | 357 SkString ss; |
| 358 toString(*src, &ss); | 358 toString(*src, &ss); |
| 359 rs.prependf("%s ", ss.c_str()); | 359 rs.prependf("%s ", ss.c_str()); |
| 360 } | 360 } |
| 361 | 361 |
| 362 this->dump(kDrawBitmap_Verb, paint, "drawBitmapRectToRect(%s %s)", | 362 this->dump(kDrawBitmap_Verb, paint, "drawBitmapRect(%s %s)", bs.c_str(), rs.
c_str()); |
| 363 bs.c_str(), rs.c_str()); | |
| 364 } | 363 } |
| 365 | 364 |
| 366 void SkDumpCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& cente
r, | 365 void SkDumpCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& cente
r, |
| 367 const SkRect& dst, const SkPaint* paint) { | 366 const SkRect& dst, const SkPaint* paint) { |
| 368 SkString str, centerStr, dstStr; | 367 SkString str, centerStr, dstStr; |
| 369 bitmap.toString(&str); | 368 bitmap.toString(&str); |
| 370 toString(center, ¢erStr); | 369 toString(center, ¢erStr); |
| 371 toString(dst, &dstStr); | 370 toString(dst, &dstStr); |
| 372 this->dump(kDrawBitmap_Verb, paint, "drawBitmapNine(%s %s %s)", str.c_str(), | 371 this->dump(kDrawBitmap_Verb, paint, "drawBitmapNine(%s %s %s)", str.c_str(), |
| 373 centerStr.c_str(), dstStr.c_str()); | 372 centerStr.c_str(), dstStr.c_str()); |
| 374 } | 373 } |
| 375 | 374 |
| 376 void SkDumpCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, con
st SkPaint* paint) { | 375 void SkDumpCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, con
st SkPaint* paint) { |
| 377 SkString str; | 376 SkString str; |
| 378 image->toString(&str); | 377 image->toString(&str); |
| 379 this->dump(kDrawBitmap_Verb, paint, "drawImage(%s %g %g)", str.c_str(), | 378 this->dump(kDrawBitmap_Verb, paint, "drawImage(%s %g %g)", str.c_str(), |
| 380 SkScalarToFloat(x), SkScalarToFloat(y)); | 379 SkScalarToFloat(x), SkScalarToFloat(y)); |
| 381 } | 380 } |
| 382 | 381 |
| 383 void SkDumpCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, cons
t SkRect& dst, | 382 void SkDumpCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, cons
t SkRect& dst, |
| 384 const SkPaint* paint) { | 383 const SkPaint* paint SRC_RECT_CONSTRAINT_PARA
M(constraint)) { |
| 385 SkString bs, rs; | 384 SkString bs, rs; |
| 386 image->toString(&bs); | 385 image->toString(&bs); |
| 387 toString(dst, &rs); | 386 toString(dst, &rs); |
| 388 // show the src-rect only if its not everything | 387 // show the src-rect only if its not everything |
| 389 if (src && (src->fLeft > 0 || src->fTop > 0 || | 388 if (src && (src->fLeft > 0 || src->fTop > 0 || |
| 390 src->fRight < SkIntToScalar(image->width()) || | 389 src->fRight < SkIntToScalar(image->width()) || |
| 391 src->fBottom < SkIntToScalar(image->height()))) { | 390 src->fBottom < SkIntToScalar(image->height()))) { |
| 392 SkString ss; | 391 SkString ss; |
| 393 toString(*src, &ss); | 392 toString(*src, &ss); |
| 394 rs.prependf("%s ", ss.c_str()); | 393 rs.prependf("%s ", ss.c_str()); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 548 |
| 550 /////////////////////////////////////////////////////////////////////////////// | 549 /////////////////////////////////////////////////////////////////////////////// |
| 551 | 550 |
| 552 static void dumpToDebugf(const char text[], void*) { | 551 static void dumpToDebugf(const char text[], void*) { |
| 553 SkDebugf("%s\n", text); | 552 SkDebugf("%s\n", text); |
| 554 } | 553 } |
| 555 | 554 |
| 556 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} | 555 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} |
| 557 | 556 |
| 558 #endif | 557 #endif |
| OLD | NEW |