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