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