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