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, SK_VIRTUAL_CONSTRAINT_
TYPE) { | 349 const SkPaint* paint, SrcRectConstraint) { |
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()); |
(...skipping 13 matching lines...) Expand all Loading... |
373 } | 373 } |
374 | 374 |
375 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) { |
376 SkString str; | 376 SkString str; |
377 image->toString(&str); | 377 image->toString(&str); |
378 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(), |
379 SkScalarToFloat(x), SkScalarToFloat(y)); | 379 SkScalarToFloat(x), SkScalarToFloat(y)); |
380 } | 380 } |
381 | 381 |
382 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, |
383 const SkPaint* paint SRC_RECT_CONSTRAINT_PARA
M(constraint)) { | 383 const SkPaint* paint, SrcRectConstraint) { |
384 SkString bs, rs; | 384 SkString bs, rs; |
385 image->toString(&bs); | 385 image->toString(&bs); |
386 toString(dst, &rs); | 386 toString(dst, &rs); |
387 // show the src-rect only if its not everything | 387 // show the src-rect only if its not everything |
388 if (src && (src->fLeft > 0 || src->fTop > 0 || | 388 if (src && (src->fLeft > 0 || src->fTop > 0 || |
389 src->fRight < SkIntToScalar(image->width()) || | 389 src->fRight < SkIntToScalar(image->width()) || |
390 src->fBottom < SkIntToScalar(image->height()))) { | 390 src->fBottom < SkIntToScalar(image->height()))) { |
391 SkString ss; | 391 SkString ss; |
392 toString(*src, &ss); | 392 toString(*src, &ss); |
393 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... |
548 | 548 |
549 /////////////////////////////////////////////////////////////////////////////// | 549 /////////////////////////////////////////////////////////////////////////////// |
550 | 550 |
551 static void dumpToDebugf(const char text[], void*) { | 551 static void dumpToDebugf(const char text[], void*) { |
552 SkDebugf("%s\n", text); | 552 SkDebugf("%s\n", text); |
553 } | 553 } |
554 | 554 |
555 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} | 555 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} |
556 | 556 |
557 #endif | 557 #endif |
OLD | NEW |