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" |
11 #include "SkObjectParser.h" | 11 #include "SkObjectParser.h" |
12 | 12 |
| 13 #include "SkTextBlob.h" |
| 14 |
13 // TODO(chudy): Refactor into non subclass model. | 15 // TODO(chudy): Refactor into non subclass model. |
14 | 16 |
15 SkDrawCommand::SkDrawCommand(DrawType type) | 17 SkDrawCommand::SkDrawCommand(DrawType type) |
16 : fDrawType(type) | 18 : fDrawType(type) |
17 , fOffset(0) | 19 , fOffset(0) |
18 , fVisible(true) { | 20 , fVisible(true) { |
19 } | 21 } |
20 | 22 |
21 SkDrawCommand::SkDrawCommand() { | 23 SkDrawCommand::SkDrawCommand() { |
22 fOffset = 0; | 24 fOffset = 0; |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod
ing())); | 638 fInfo.push(SkObjectParser::TextToString(text, byteLength, paint.getTextEncod
ing())); |
637 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); | 639 fInfo.push(SkObjectParser::ScalarToString(xpos[0], "XPOS: ")); |
638 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); | 640 fInfo.push(SkObjectParser::ScalarToString(constY, "SkScalar constY: ")); |
639 fInfo.push(SkObjectParser::PaintToString(paint)); | 641 fInfo.push(SkObjectParser::PaintToString(paint)); |
640 } | 642 } |
641 | 643 |
642 void SkDrawPosTextHCommand::execute(SkCanvas* canvas) { | 644 void SkDrawPosTextHCommand::execute(SkCanvas* canvas) { |
643 canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); | 645 canvas->drawPosTextH(fText, fByteLength, fXpos, fConstY, fPaint); |
644 } | 646 } |
645 | 647 |
| 648 SkDrawTextBlobCommand::SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x,
SkScalar y, |
| 649 const SkPaint& paint) |
| 650 : INHERITED(DRAW_TEXT_BLOB) |
| 651 , fBlob(blob) |
| 652 , fXPos(x) |
| 653 , fYPos(y) |
| 654 , fPaint(paint) { |
| 655 |
| 656 blob->ref(); |
| 657 |
| 658 // FIXME: push blob info |
| 659 fInfo.push(SkObjectParser::ScalarToString(x, "XPOS: ")); |
| 660 fInfo.push(SkObjectParser::ScalarToString(x, "YPOS: ")); |
| 661 fInfo.push(SkObjectParser::PaintToString(paint)); |
| 662 } |
| 663 |
| 664 void SkDrawTextBlobCommand::execute(SkCanvas* canvas) { |
| 665 canvas->drawTextBlob(fBlob, fXPos, fYPos, fPaint); |
| 666 } |
| 667 |
646 SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint) | 668 SkDrawRectCommand::SkDrawRectCommand(const SkRect& rect, const SkPaint& paint) |
647 : INHERITED(DRAW_RECT) { | 669 : INHERITED(DRAW_RECT) { |
648 fRect = rect; | 670 fRect = rect; |
649 fPaint = paint; | 671 fPaint = paint; |
650 | 672 |
651 fInfo.push(SkObjectParser::RectToString(rect)); | 673 fInfo.push(SkObjectParser::RectToString(rect)); |
652 fInfo.push(SkObjectParser::PaintToString(paint)); | 674 fInfo.push(SkObjectParser::PaintToString(paint)); |
653 } | 675 } |
654 | 676 |
655 void SkDrawRectCommand::execute(SkCanvas* canvas) { | 677 void SkDrawRectCommand::execute(SkCanvas* canvas) { |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 p.setColor(SK_ColorCYAN); | 1001 p.setColor(SK_ColorCYAN); |
980 p.setStyle(SkPaint::kStroke_Style); | 1002 p.setStyle(SkPaint::kStroke_Style); |
981 canvas->drawRect(fCullRect, p); | 1003 canvas->drawRect(fCullRect, p); |
982 } | 1004 } |
983 | 1005 |
984 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } | 1006 SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } |
985 | 1007 |
986 void SkPopCullCommand::execute(SkCanvas* canvas) { | 1008 void SkPopCullCommand::execute(SkCanvas* canvas) { |
987 canvas->popCull(); | 1009 canvas->popCull(); |
988 } | 1010 } |
OLD | NEW |