Chromium Code Reviews| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 } | 478 } |
| 479 | 479 |
| 480 bool SkDrawPathCommand::render(SkCanvas* canvas) const { | 480 bool SkDrawPathCommand::render(SkCanvas* canvas) const { |
| 481 render_path(canvas, fPath); | 481 render_path(canvas, fPath); |
| 482 return true; | 482 return true; |
| 483 } | 483 } |
| 484 | 484 |
| 485 SkDrawPictureCommand::SkDrawPictureCommand(SkPicture& picture) : | 485 SkDrawPictureCommand::SkDrawPictureCommand(SkPicture& picture) : |
| 486 fPicture(picture) { | 486 fPicture(picture) { |
| 487 fDrawType = DRAW_PICTURE; | 487 fDrawType = DRAW_PICTURE; |
| 488 fInfo.push(SkObjectParser::CustomTextToString("To be implemented.")); | 488 SkString* temp = new SkString; |
| 489 temp->appendf("SkPicture: W: %d H: %d", picture.width(), picture.height()); | |
| 490 fInfo.push(temp); | |
| 489 } | 491 } |
| 490 | 492 |
| 491 void SkDrawPictureCommand::execute(SkCanvas* canvas) { | 493 void SkDrawPictureCommand::execute(SkCanvas* canvas) { |
| 492 canvas->drawPicture(fPicture); | 494 canvas->drawPicture(fPicture); |
| 493 } | 495 } |
| 494 | 496 |
| 497 bool SkDrawPictureCommand::render(SkCanvas* canvas) const { | |
| 498 canvas->clear(0xFFFFFFFF); | |
| 499 canvas->save(); | |
| 500 | |
| 501 SkRect bounds = SkRect::MakeWH(fPicture.width(), fPicture.height()); | |
| 502 xlate_and_scale_to_bounds(canvas, bounds); | |
| 503 | |
|
robertphillips
2013/11/21 16:46:38
drawPicture should take a const SkPicture :(
| |
| 504 canvas->drawPicture(const_cast<SkPicture&>(fPicture)); | |
| 505 | |
| 506 canvas->restore(); | |
| 507 | |
| 508 return true; | |
| 509 } | |
| 510 | |
| 495 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, | 511 SkDrawPointsCommand::SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, |
| 496 const SkPoint pts[], const SkPaint& pai nt) { | 512 const SkPoint pts[], const SkPaint& pai nt) { |
| 497 fMode = mode; | 513 fMode = mode; |
| 498 fCount = count; | 514 fCount = count; |
| 499 fPts = new SkPoint[count]; | 515 fPts = new SkPoint[count]; |
| 500 memcpy(fPts, pts, count * sizeof(SkPoint)); | 516 memcpy(fPts, pts, count * sizeof(SkPoint)); |
| 501 fPaint = paint; | 517 fPaint = paint; |
| 502 fDrawType = DRAW_POINTS; | 518 fDrawType = DRAW_POINTS; |
| 503 | 519 |
| 504 fInfo.push(SkObjectParser::PointsToString(pts, count)); | 520 fInfo.push(SkObjectParser::PointsToString(pts, count)); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 fDy = dy; | 889 fDy = dy; |
| 874 fDrawType = TRANSLATE; | 890 fDrawType = TRANSLATE; |
| 875 | 891 |
| 876 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); | 892 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); |
| 877 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); | 893 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); |
| 878 } | 894 } |
| 879 | 895 |
| 880 void SkTranslateCommand::execute(SkCanvas* canvas) { | 896 void SkTranslateCommand::execute(SkCanvas* canvas) { |
| 881 canvas->translate(fDx, fDy); | 897 canvas->translate(fDx, fDy); |
| 882 } | 898 } |
| OLD | NEW |