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