OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 | 9 |
10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 if (NULL != matrix) { | 516 if (NULL != matrix) { |
517 fMatrix = *matrix; | 517 fMatrix = *matrix; |
518 fMatrixPtr = &fMatrix; | 518 fMatrixPtr = &fMatrix; |
519 } | 519 } |
520 if (NULL != paint) { | 520 if (NULL != paint) { |
521 fPaint = *paint; | 521 fPaint = *paint; |
522 fPaintPtr = &fPaint; | 522 fPaintPtr = &fPaint; |
523 } | 523 } |
524 | 524 |
525 SkString* temp = new SkString; | 525 SkString* temp = new SkString; |
526 temp->appendf("SkPicture: W: %d H: %d", picture->width(), picture->height())
; | 526 temp->appendf("SkPicture: L: %f T: %f R: %f B: %f", |
| 527 picture->cullRect().fLeft, picture->cullRect().fTop, |
| 528 picture->cullRect().fRight, picture->cullRect().fBottom); |
527 fInfo.push(temp); | 529 fInfo.push(temp); |
528 if (NULL != matrix) { | 530 if (NULL != matrix) { |
529 fInfo.push(SkObjectParser::MatrixToString(*matrix)); | 531 fInfo.push(SkObjectParser::MatrixToString(*matrix)); |
530 } | 532 } |
531 if (NULL != paint) { | 533 if (NULL != paint) { |
532 fInfo.push(SkObjectParser::PaintToString(*paint)); | 534 fInfo.push(SkObjectParser::PaintToString(*paint)); |
533 } | 535 } |
534 } | 536 } |
535 | 537 |
536 void SkDrawPictureCommand::execute(SkCanvas* canvas) { | 538 void SkDrawPictureCommand::execute(SkCanvas* canvas) { |
537 canvas->drawPicture(fPicture, fMatrixPtr, fPaintPtr); | 539 canvas->drawPicture(fPicture, fMatrixPtr, fPaintPtr); |
538 } | 540 } |
539 | 541 |
540 bool SkDrawPictureCommand::render(SkCanvas* canvas) const { | 542 bool SkDrawPictureCommand::render(SkCanvas* canvas) const { |
541 canvas->clear(0xFFFFFFFF); | 543 canvas->clear(0xFFFFFFFF); |
542 canvas->save(); | 544 canvas->save(); |
543 | 545 |
544 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()), | 546 xlate_and_scale_to_bounds(canvas, fPicture->cullRect()); |
545 SkIntToScalar(fPicture->height())); | |
546 xlate_and_scale_to_bounds(canvas, bounds); | |
547 | 547 |
548 canvas->drawPicture(fPicture.get()); | 548 canvas->drawPicture(fPicture.get()); |
549 | 549 |
550 canvas->restore(); | 550 canvas->restore(); |
551 | 551 |
552 return true; | 552 return true; |
553 } | 553 } |
554 | 554 |
555 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, | 555 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, |
556 const SkPoint pts[], const SkPaint& pai
nt) | 556 const SkPoint pts[], const SkPaint& pai
nt) |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 p.setColor(SK_ColorCYAN); | 1002 p.setColor(SK_ColorCYAN); |
1003 p.setStyle(SkPaint::kStroke_Style); | 1003 p.setStyle(SkPaint::kStroke_Style); |
1004 canvas->drawRect(fCullRect, p); | 1004 canvas->drawRect(fCullRect, p); |
1005 } | 1005 } |
1006 | 1006 |
1007 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } | 1007 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } |
1008 | 1008 |
1009 void SkPopCullCommand::execute(SkCanvas* canvas) { | 1009 void SkPopCullCommand::execute(SkCanvas* canvas) { |
1010 canvas->popCull(); | 1010 canvas->popCull(); |
1011 } | 1011 } |
OLD | NEW |