chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #ifndef SKDRAWCOMMAND_H_ |
| 10 | #define SKDRAWCOMMAND_H_ |
| 11 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 12 | #include "SkPictureFlat.h" |
| 13 | #include "SkCanvas.h" |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 14 | #include "SkString.h" |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 15 | |
fmalita@google.com | 86681b3 | 2013-06-13 20:59:14 +0000 | [diff] [blame] | 16 | class SK_API SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 17 | public: |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 18 | SkDrawCommand(DrawType drawType); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 19 | |
| 20 | virtual ~SkDrawCommand(); |
| 21 | |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 22 | virtual SkString toString() const; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 23 | |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 24 | void setOffset(size_t offset) { fOffset = offset; } |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 25 | size_t offset() const { return fOffset; } |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 26 | |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 27 | virtual const char* toCString() const { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 28 | return GetCommandString(fDrawType); |
| 29 | } |
| 30 | |
chudy@google.com | 0b5bbb0 | 2012-07-31 19:55:32 +0000 | [diff] [blame] | 31 | bool isVisible() const { |
| 32 | return fVisible; |
| 33 | } |
| 34 | |
| 35 | void setVisible(bool toggle) { |
| 36 | fVisible = toggle; |
| 37 | } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 38 | |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 39 | const SkTDArray<SkString*>* Info() const { return &fInfo; } |
| 40 | virtual void execute(SkCanvas*) const = 0; |
| 41 | virtual void vizExecute(SkCanvas*) const {} |
robertphillips | 7017168 | 2014-10-16 14:28:28 -0700 | [diff] [blame] | 42 | |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 43 | virtual void setUserMatrix(const SkMatrix&) {} |
robertphillips | 7017168 | 2014-10-16 14:28:28 -0700 | [diff] [blame] | 44 | |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 45 | /** Does nothing by default, but used by save() and restore()-type |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 46 | subclasses to track unresolved save() calls. */ |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 47 | virtual void trackSaveState(int* state) {} |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 48 | |
mtklein | f0f1411 | 2014-12-12 08:46:25 -0800 | [diff] [blame] | 49 | // The next "active" system is only used by save, saveLayer, and restore. |
| 50 | // It is used to determine which saveLayers are currently active (at a |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 51 | // given point in the rendering). |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 52 | // saves just return a kPushLayer action but don't track active state |
| 53 | // restores just return a kPopLayer action |
commit-bot@chromium.org | 1643b2c | 2014-03-03 23:25:41 +0000 | [diff] [blame] | 54 | // saveLayers return kPushLayer but also track the active state |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 55 | enum Action { |
| 56 | kNone_Action, |
commit-bot@chromium.org | 1643b2c | 2014-03-03 23:25:41 +0000 | [diff] [blame] | 57 | kPopLayer_Action, |
| 58 | kPushLayer_Action, |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 59 | }; |
| 60 | virtual Action action() const { return kNone_Action; } |
| 61 | virtual void setActive(bool active) {} |
| 62 | virtual bool active() const { return false; } |
| 63 | |
fmalita | 8c89c52 | 2014-11-08 16:18:56 -0800 | [diff] [blame] | 64 | DrawType getType() const { return fDrawType; } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 65 | |
robertphillips@google.com | 6ede1fe | 2013-06-06 23:59:28 +0000 | [diff] [blame] | 66 | virtual bool render(SkCanvas* canvas) const { return false; } |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 67 | |
robertphillips@google.com | 8a1cdae | 2012-11-19 20:44:29 +0000 | [diff] [blame] | 68 | static const char* GetCommandString(DrawType type); |
| 69 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 70 | protected: |
chudy@google.com | 97cee97 | 2012-08-07 20:41:37 +0000 | [diff] [blame] | 71 | SkTDArray<SkString*> fInfo; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 72 | |
| 73 | private: |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 74 | DrawType fDrawType; |
| 75 | size_t fOffset; |
| 76 | bool fVisible; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 79 | class SkRestoreCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 80 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 81 | SkRestoreCommand(); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 82 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 83 | void trackSaveState(int* state) SK_OVERRIDE; |
| 84 | Action action() const SK_OVERRIDE { return kPopLayer_Action; } |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 85 | |
| 86 | private: |
| 87 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 90 | class SkClearCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 91 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 92 | SkClearCommand(SkColor color); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 93 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 94 | private: |
| 95 | SkColor fColor; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 96 | |
| 97 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 98 | }; |
| 99 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 100 | class SkClipPathCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 101 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 102 | SkClipPathCommand(const SkPath& path, SkRegion::Op op, bool doAA); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 103 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 104 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 105 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 106 | SkPath fPath; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 107 | SkRegion::Op fOp; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 108 | bool fDoAA; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 109 | |
| 110 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 111 | }; |
| 112 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 113 | class SkClipRegionCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 114 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 115 | SkClipRegionCommand(const SkRegion& region, SkRegion::Op op); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 116 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 117 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 118 | SkRegion fRegion; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 119 | SkRegion::Op fOp; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 120 | |
| 121 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 122 | }; |
| 123 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 124 | class SkClipRectCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 125 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 126 | SkClipRectCommand(const SkRect& rect, SkRegion::Op op, bool doAA); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 127 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 128 | |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 129 | const SkRect& rect() const { return fRect; } |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 130 | SkRegion::Op op() const { return fOp; } |
| 131 | bool doAA() const { return fDoAA; } |
| 132 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 133 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 134 | SkRect fRect; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 135 | SkRegion::Op fOp; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 136 | bool fDoAA; |
| 137 | |
| 138 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 141 | class SkClipRRectCommand : public SkDrawCommand { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 142 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 143 | SkClipRRectCommand(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 144 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 145 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 146 | |
| 147 | const SkRRect& rrect() const { return fRRect; } |
| 148 | SkRegion::Op op() const { return fOp; } |
| 149 | bool doAA() const { return fDoAA; } |
| 150 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 151 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 152 | SkRRect fRRect; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 153 | SkRegion::Op fOp; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 154 | bool fDoAA; |
| 155 | |
| 156 | typedef SkDrawCommand INHERITED; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 157 | }; |
| 158 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 159 | class SkConcatCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 160 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 161 | SkConcatCommand(const SkMatrix& matrix); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 162 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 163 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 164 | SkMatrix fMatrix; |
| 165 | |
| 166 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 167 | }; |
| 168 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 169 | class SkDrawBitmapCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 170 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 171 | SkDrawBitmapCommand(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 172 | const SkPaint* paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 173 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 174 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 175 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 176 | SkBitmap fBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 177 | SkScalar fLeft; |
| 178 | SkScalar fTop; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 179 | SkPaint fPaint; |
| 180 | SkPaint* fPaintPtr; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 181 | |
| 182 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 183 | }; |
| 184 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 185 | class SkDrawBitmapNineCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 186 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 187 | SkDrawBitmapNineCommand(const SkBitmap& bitmap, const SkIRect& center, |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 188 | const SkRect& dst, const SkPaint* paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 189 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 190 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 191 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 192 | SkBitmap fBitmap; |
| 193 | SkIRect fCenter; |
| 194 | SkRect fDst; |
| 195 | SkPaint fPaint; |
| 196 | SkPaint* fPaintPtr; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 197 | |
| 198 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 199 | }; |
| 200 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 201 | class SkDrawBitmapRectCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 202 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 203 | SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 204 | const SkRect& dst, const SkPaint* paint, |
| 205 | SkCanvas::DrawBitmapRectFlags flags); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 206 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 207 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 208 | |
robertphillips@google.com | c3410b8 | 2013-03-28 12:25:25 +0000 | [diff] [blame] | 209 | const SkBitmap& bitmap() const { return fBitmap; } |
| 210 | |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 211 | // The non-const 'paint' method allows modification of this object's |
| 212 | // SkPaint. For this reason the ctor and setPaint method make a local copy. |
| 213 | // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
| 214 | // (since only an SkPaint* is passed into the ctor). |
| 215 | const SkPaint* paint() const { return fPaintPtr; } |
| 216 | SkPaint* paint() { return fPaintPtr; } |
| 217 | |
| 218 | void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
| 219 | |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 220 | const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } |
robertphillips@google.com | c3410b8 | 2013-03-28 12:25:25 +0000 | [diff] [blame] | 221 | void setSrcRect(const SkRect& src) { fSrc = src; } |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 222 | |
| 223 | const SkRect& dstRect() const { return fDst; } |
robertphillips@google.com | c3410b8 | 2013-03-28 12:25:25 +0000 | [diff] [blame] | 224 | void setDstRect(const SkRect& dst) { fDst = dst; } |
| 225 | |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 226 | SkCanvas::DrawBitmapRectFlags flags() const { return fFlags; } |
| 227 | void setFlags(SkCanvas::DrawBitmapRectFlags flags) { fFlags = flags; } |
| 228 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 229 | private: |
commit-bot@chromium.org | eed779d | 2013-08-16 10:24:37 +0000 | [diff] [blame] | 230 | SkBitmap fBitmap; |
| 231 | SkRect fSrc; |
| 232 | SkRect fDst; |
| 233 | SkPaint fPaint; |
| 234 | SkPaint* fPaintPtr; |
| 235 | SkCanvas::DrawBitmapRectFlags fFlags; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 236 | |
| 237 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 238 | }; |
| 239 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 240 | class SkBeginCommentGroupCommand : public SkDrawCommand { |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 241 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 242 | SkBeginCommentGroupCommand(const char* description); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 243 | void execute(SkCanvas* canvas) const SK_OVERRIDE { |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 244 | canvas->beginCommentGroup(fDescription.c_str()); |
| 245 | }; |
| 246 | private: |
| 247 | SkString fDescription; |
| 248 | |
| 249 | typedef SkDrawCommand INHERITED; |
| 250 | }; |
| 251 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 252 | class SkCommentCommand : public SkDrawCommand { |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 253 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 254 | SkCommentCommand(const char* kywd, const char* value); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 255 | void execute(SkCanvas* canvas) const SK_OVERRIDE { |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 256 | canvas->addComment(fKywd.c_str(), fValue.c_str()); |
| 257 | }; |
| 258 | private: |
| 259 | SkString fKywd; |
| 260 | SkString fValue; |
| 261 | |
| 262 | typedef SkDrawCommand INHERITED; |
| 263 | }; |
| 264 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 265 | class SkEndCommentGroupCommand : public SkDrawCommand { |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 266 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 267 | SkEndCommentGroupCommand(); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 268 | void execute(SkCanvas* canvas) const SK_OVERRIDE { |
robertphillips@google.com | 0a4805e | 2013-05-29 13:24:23 +0000 | [diff] [blame] | 269 | canvas->endCommentGroup(); |
| 270 | }; |
| 271 | private: |
| 272 | typedef SkDrawCommand INHERITED; |
| 273 | }; |
| 274 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 275 | class SkDrawOvalCommand : public SkDrawCommand { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 276 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 277 | SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 278 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 279 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 280 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 281 | SkRect fOval; |
| 282 | SkPaint fPaint; |
| 283 | |
| 284 | typedef SkDrawCommand INHERITED; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 285 | }; |
| 286 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 287 | class SkDrawPaintCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 288 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 289 | SkDrawPaintCommand(const SkPaint& paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 290 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 291 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 292 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 293 | SkPaint fPaint; |
| 294 | |
| 295 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 296 | }; |
| 297 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 298 | class SkDrawPathCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 299 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 300 | SkDrawPathCommand(const SkPath& path, const SkPaint& paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 301 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 302 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 303 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 304 | private: |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 305 | SkPath fPath; |
| 306 | SkPaint fPaint; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 307 | |
| 308 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 309 | }; |
| 310 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 311 | class SkDrawPictureCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 312 | public: |
robertphillips | b3f319f | 2014-08-13 10:46:23 -0700 | [diff] [blame] | 313 | SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 314 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 315 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
commit-bot@chromium.org | e898e9c | 2013-11-21 17:08:12 +0000 | [diff] [blame] | 316 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 317 | private: |
robertphillips | 9b14f26 | 2014-06-04 05:40:44 -0700 | [diff] [blame] | 318 | SkAutoTUnref<const SkPicture> fPicture; |
robertphillips | b3f319f | 2014-08-13 10:46:23 -0700 | [diff] [blame] | 319 | SkMatrix fMatrix; |
| 320 | SkMatrix* fMatrixPtr; |
| 321 | SkPaint fPaint; |
| 322 | SkPaint* fPaintPtr; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 323 | |
| 324 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 325 | }; |
| 326 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 327 | class SkDrawPointsCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 328 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 329 | SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 330 | const SkPaint& paint); |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 331 | virtual ~SkDrawPointsCommand() { delete [] fPts; } |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 332 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 333 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 334 | private: |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 335 | SkCanvas::PointMode fMode; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 336 | size_t fCount; |
| 337 | SkPoint* fPts; |
| 338 | SkPaint fPaint; |
| 339 | |
| 340 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 341 | }; |
| 342 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 343 | class SkDrawTextCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 344 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 345 | SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
commit-bot@chromium.org | 57f74e0 | 2014-03-25 23:31:33 +0000 | [diff] [blame] | 346 | const SkPaint& paint); |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 347 | virtual ~SkDrawTextCommand() { delete [] fText; } |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 348 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 349 | private: |
robertphillips@google.com | 77279cb | 2013-03-25 12:01:45 +0000 | [diff] [blame] | 350 | char* fText; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 351 | size_t fByteLength; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 352 | SkScalar fX; |
| 353 | SkScalar fY; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 354 | SkPaint fPaint; |
| 355 | |
| 356 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 357 | }; |
| 358 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 359 | class SkDrawPosTextCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 360 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 361 | SkDrawPosTextCommand(const void* text, size_t byteLength, const SkPoint pos[], |
| 362 | const SkPaint& paint); |
| 363 | virtual ~SkDrawPosTextCommand() { delete [] fPos; delete [] fText; } |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 364 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 365 | private: |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 366 | char* fText; |
| 367 | size_t fByteLength; |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 368 | SkPoint* fPos; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 369 | SkPaint fPaint; |
| 370 | |
| 371 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 372 | }; |
| 373 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 374 | class SkDrawTextOnPathCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 375 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 376 | SkDrawTextOnPathCommand(const void* text, size_t byteLength, const SkPath& path, |
| 377 | const SkMatrix* matrix, const SkPaint& paint); |
| 378 | virtual ~SkDrawTextOnPathCommand() { delete [] fText; } |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 379 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 380 | private: |
robertphillips@google.com | 77279cb | 2013-03-25 12:01:45 +0000 | [diff] [blame] | 381 | char* fText; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 382 | size_t fByteLength; |
| 383 | SkPath fPath; |
| 384 | SkMatrix fMatrix; |
| 385 | SkPaint fPaint; |
| 386 | |
| 387 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 388 | }; |
| 389 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 390 | class SkDrawPosTextHCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 391 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 392 | SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xpos[], |
| 393 | SkScalar constY, const SkPaint& paint); |
| 394 | virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 395 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 396 | private: |
robertphillips@google.com | a3a09ab | 2013-03-22 12:25:30 +0000 | [diff] [blame] | 397 | SkScalar* fXpos; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 398 | char* fText; |
| 399 | size_t fByteLength; |
| 400 | SkScalar fConstY; |
| 401 | SkPaint fPaint; |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 402 | |
| 403 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 404 | }; |
| 405 | |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 406 | class SkDrawTextBlobCommand : public SkDrawCommand { |
| 407 | public: |
| 408 | SkDrawTextBlobCommand(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint); |
| 409 | |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 410 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 411 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
fmalita | b742517 | 2014-08-26 07:56:44 -0700 | [diff] [blame] | 412 | |
| 413 | private: |
| 414 | SkAutoTUnref<const SkTextBlob> fBlob; |
| 415 | SkScalar fXPos; |
| 416 | SkScalar fYPos; |
| 417 | SkPaint fPaint; |
| 418 | |
| 419 | typedef SkDrawCommand INHERITED; |
| 420 | }; |
| 421 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 422 | class SkDrawRectCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 423 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 424 | SkDrawRectCommand(const SkRect& rect, const SkPaint& paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 425 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 426 | |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 427 | const SkRect& rect() const { return fRect; } |
| 428 | const SkPaint& paint() const { return fPaint; } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 429 | private: |
robertphillips@google.com | 91217d0 | 2013-03-17 18:33:46 +0000 | [diff] [blame] | 430 | SkRect fRect; |
| 431 | SkPaint fPaint; |
| 432 | |
| 433 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 434 | }; |
| 435 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 436 | class SkDrawRRectCommand : public SkDrawCommand { |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 437 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 438 | SkDrawRRectCommand(const SkRRect& rrect, const SkPaint& paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 439 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 440 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 441 | private: |
| 442 | SkRRect fRRect; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame] | 443 | SkPaint fPaint; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 444 | |
| 445 | typedef SkDrawCommand INHERITED; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 446 | }; |
| 447 | |
commit-bot@chromium.org | 3d30520 | 2014-02-24 17:28:55 +0000 | [diff] [blame] | 448 | class SkDrawDRRectCommand : public SkDrawCommand { |
| 449 | public: |
| 450 | SkDrawDRRectCommand(const SkRRect& outer, const SkRRect& inner, |
| 451 | const SkPaint& paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 452 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 453 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
commit-bot@chromium.org | 3d30520 | 2014-02-24 17:28:55 +0000 | [diff] [blame] | 454 | private: |
| 455 | SkRRect fOuter; |
| 456 | SkRRect fInner; |
| 457 | SkPaint fPaint; |
| 458 | |
| 459 | typedef SkDrawCommand INHERITED; |
| 460 | }; |
| 461 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 462 | class SkDrawSpriteCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 463 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 464 | SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top, const SkPaint* paint); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 465 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 466 | bool render(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 467 | private: |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 468 | SkBitmap fBitmap; |
| 469 | int fLeft; |
| 470 | int fTop; |
| 471 | SkPaint fPaint; |
| 472 | SkPaint* fPaintPtr; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 473 | |
| 474 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 475 | }; |
| 476 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 477 | class SkDrawVerticesCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 478 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 479 | SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount, |
| 480 | const SkPoint vertices[], const SkPoint texs[], |
| 481 | const SkColor colors[], SkXfermode* xfermode, |
| 482 | const uint16_t indices[], int indexCount, |
| 483 | const SkPaint& paint); |
| 484 | virtual ~SkDrawVerticesCommand(); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 485 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 486 | private: |
| 487 | SkCanvas::VertexMode fVmode; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 488 | int fVertexCount; |
| 489 | SkPoint* fVertices; |
| 490 | SkPoint* fTexs; |
| 491 | SkColor* fColors; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 492 | SkXfermode* fXfermode; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 493 | uint16_t* fIndices; |
| 494 | int fIndexCount; |
| 495 | SkPaint fPaint; |
| 496 | |
| 497 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 498 | }; |
| 499 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 500 | class SkRotateCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 501 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 502 | SkRotateCommand(SkScalar degrees); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 503 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 504 | private: |
| 505 | SkScalar fDegrees; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 506 | |
| 507 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 508 | }; |
| 509 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 510 | class SkSaveCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 511 | public: |
Florin Malita | 5f6102d | 2014-06-30 10:13:28 -0400 | [diff] [blame] | 512 | SkSaveCommand(); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 513 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 514 | void trackSaveState(int* state) SK_OVERRIDE; |
| 515 | Action action() const SK_OVERRIDE { return kPushLayer_Action; } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 516 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 517 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 518 | }; |
| 519 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 520 | class SkSaveLayerCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 521 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 522 | SkSaveLayerCommand(const SkRect* bounds, const SkPaint* paint, |
| 523 | SkCanvas::SaveFlags flags); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 524 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
| 525 | void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; |
| 526 | void trackSaveState(int* state) SK_OVERRIDE; |
| 527 | Action action() const SK_OVERRIDE{ return kPushLayer_Action; } |
| 528 | void setActive(bool active) SK_OVERRIDE { fActive = active; } |
| 529 | bool active() const SK_OVERRIDE { return fActive; } |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 530 | |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 531 | const SkPaint* paint() const { return fPaintPtr; } |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 532 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 533 | private: |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 534 | SkRect fBounds; |
| 535 | SkPaint fPaint; |
| 536 | SkPaint* fPaintPtr; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 537 | SkCanvas::SaveFlags fFlags; |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 538 | |
commit-bot@chromium.org | 768ac85 | 2014-03-03 16:32:17 +0000 | [diff] [blame] | 539 | bool fActive; |
| 540 | |
robertphillips@google.com | 24bfdac | 2013-03-22 16:33:31 +0000 | [diff] [blame] | 541 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 542 | }; |
| 543 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 544 | class SkScaleCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 545 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 546 | SkScaleCommand(SkScalar sx, SkScalar sy); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 547 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | 9105ad0 | 2013-03-17 18:46:16 +0000 | [diff] [blame] | 548 | |
| 549 | SkScalar x() const { return fSx; } |
| 550 | SkScalar y() const { return fSy; } |
| 551 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 552 | private: |
| 553 | SkScalar fSx; |
| 554 | SkScalar fSy; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 555 | |
| 556 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 557 | }; |
| 558 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 559 | class SkSetMatrixCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 560 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 561 | SkSetMatrixCommand(const SkMatrix& matrix); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 562 | void setUserMatrix(const SkMatrix&) SK_OVERRIDE; |
| 563 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 564 | private: |
robertphillips | 7017168 | 2014-10-16 14:28:28 -0700 | [diff] [blame] | 565 | SkMatrix fUserMatrix; |
robertphillips@google.com | b94b1e7 | 2013-02-19 21:00:26 +0000 | [diff] [blame] | 566 | SkMatrix fMatrix; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 567 | |
| 568 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 569 | }; |
| 570 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 571 | class SkSkewCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 572 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 573 | SkSkewCommand(SkScalar sx, SkScalar sy); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 574 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 575 | private: |
| 576 | SkScalar fSx; |
| 577 | SkScalar fSy; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 578 | |
| 579 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 580 | }; |
| 581 | |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 582 | class SkTranslateCommand : public SkDrawCommand { |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 583 | public: |
commit-bot@chromium.org | 7a11591 | 2013-06-18 20:20:55 +0000 | [diff] [blame] | 584 | SkTranslateCommand(SkScalar dx, SkScalar dy); |
mtklein | 72c9faa | 2015-01-09 10:06:39 -0800 | [diff] [blame] | 585 | void execute(SkCanvas* canvas) const SK_OVERRIDE; |
robertphillips@google.com | 9105ad0 | 2013-03-17 18:46:16 +0000 | [diff] [blame] | 586 | |
| 587 | SkScalar x() const { return fDx; } |
| 588 | SkScalar y() const { return fDy; } |
| 589 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 590 | private: |
| 591 | SkScalar fDx; |
| 592 | SkScalar fDy; |
robertphillips@google.com | 0df2a9a | 2013-03-25 11:50:42 +0000 | [diff] [blame] | 593 | |
| 594 | typedef SkDrawCommand INHERITED; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 595 | }; |
| 596 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 597 | #endif |