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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 495 |
496 void SkDrawPathCommand::execute(SkCanvas* canvas) { | 496 void SkDrawPathCommand::execute(SkCanvas* canvas) { |
497 canvas->drawPath(fPath, fPaint); | 497 canvas->drawPath(fPath, fPaint); |
498 } | 498 } |
499 | 499 |
500 bool SkDrawPathCommand::render(SkCanvas* canvas) const { | 500 bool SkDrawPathCommand::render(SkCanvas* canvas) const { |
501 render_path(canvas, fPath); | 501 render_path(canvas, fPath); |
502 return true; | 502 return true; |
503 } | 503 } |
504 | 504 |
505 SkDrawPictureCommand::SkDrawPictureCommand(SkPicture& picture) | 505 SkDrawPictureCommand::SkDrawPictureCommand(const SkPicture* picture) |
506 : INHERITED(DRAW_PICTURE) | 506 : INHERITED(DRAW_PICTURE) |
507 , fPicture(picture) { | 507 , fPicture(SkRef(picture)) { |
508 SkString* temp = new SkString; | 508 SkString* temp = new SkString; |
509 temp->appendf("SkPicture: W: %d H: %d", picture.width(), picture.height()); | 509 temp->appendf("SkPicture: W: %d H: %d", picture->width(), picture->height())
; |
510 fInfo.push(temp); | 510 fInfo.push(temp); |
511 } | 511 } |
512 | 512 |
513 void SkDrawPictureCommand::execute(SkCanvas* canvas) { | 513 void SkDrawPictureCommand::execute(SkCanvas* canvas) { |
514 canvas->drawPicture(fPicture); | 514 canvas->drawPicture(fPicture); |
515 } | 515 } |
516 | 516 |
517 bool SkDrawPictureCommand::render(SkCanvas* canvas) const { | 517 bool SkDrawPictureCommand::render(SkCanvas* canvas) const { |
518 canvas->clear(0xFFFFFFFF); | 518 canvas->clear(0xFFFFFFFF); |
519 canvas->save(); | 519 canvas->save(); |
520 | 520 |
521 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture.width()), | 521 SkRect bounds = SkRect::MakeWH(SkIntToScalar(fPicture->width()), |
522 SkIntToScalar(fPicture.height())); | 522 SkIntToScalar(fPicture->height())); |
523 xlate_and_scale_to_bounds(canvas, bounds); | 523 xlate_and_scale_to_bounds(canvas, bounds); |
524 | 524 |
525 canvas->drawPicture(const_cast<SkPicture&>(fPicture)); | 525 canvas->drawPicture(fPicture.get()); |
526 | 526 |
527 canvas->restore(); | 527 canvas->restore(); |
528 | 528 |
529 return true; | 529 return true; |
530 } | 530 } |
531 | 531 |
532 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, | 532 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, |
533 const SkPoint pts[], const SkPaint& pai
nt) | 533 const SkPoint pts[], const SkPaint& pai
nt) |
534 : INHERITED(DRAW_POINTS) { | 534 : INHERITED(DRAW_POINTS) { |
535 fMode = mode; | 535 fMode = mode; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 p.setColor(SK_ColorCYAN); | 961 p.setColor(SK_ColorCYAN); |
962 p.setStyle(SkPaint::kStroke_Style); | 962 p.setStyle(SkPaint::kStroke_Style); |
963 canvas->drawRect(fCullRect, p); | 963 canvas->drawRect(fCullRect, p); |
964 } | 964 } |
965 | 965 |
966 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } | 966 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } |
967 | 967 |
968 void SkPopCullCommand::execute(SkCanvas* canvas) { | 968 void SkPopCullCommand::execute(SkCanvas* canvas) { |
969 canvas->popCull(); | 969 canvas->popCull(); |
970 } | 970 } |
OLD | NEW |