chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #ifndef SKDRAWCOMMAND_H_ |
| 10 | #define SKDRAWCOMMAND_H_ |
| 11 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 12 | #include "SkPictureFlat.h" |
| 13 | #include "SkCanvas.h" |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 14 | |
| 15 | class SkDrawCommand { |
| 16 | public: |
| 17 | /* TODO(chudy): Remove subclasses. */ |
| 18 | SkDrawCommand(); |
| 19 | |
| 20 | virtual ~SkDrawCommand(); |
| 21 | |
chudy@google.com | 97cee97 | 2012-08-07 20:41:37 +0000 | [diff] [blame] | 22 | virtual SkString toString(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 23 | |
| 24 | virtual const char* toCString() { |
| 25 | return GetCommandString(fDrawType); |
| 26 | } |
| 27 | |
chudy@google.com | 0b5bbb0 | 2012-07-31 19:55:32 +0000 | [diff] [blame] | 28 | bool isVisible() const { |
| 29 | return fVisible; |
| 30 | } |
| 31 | |
| 32 | void setVisible(bool toggle) { |
| 33 | fVisible = toggle; |
| 34 | } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 35 | |
chudy@google.com | 97cee97 | 2012-08-07 20:41:37 +0000 | [diff] [blame] | 36 | SkTDArray<SkString*>* Info() {return &fInfo; }; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 37 | virtual void execute(SkCanvas* canvas)=0; |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 38 | /** Does nothing by default, but used by save() and restore()-type |
| 39 | subclassse to track unresolved save() calls. */ |
| 40 | virtual void trackSaveState(int* state) { }; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 41 | DrawType getType() { return fDrawType; }; |
| 42 | |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 43 | virtual const SkBitmap* getBitmap() const { return NULL; } |
| 44 | |
robertphillips@google.com | 8a1cdae | 2012-11-19 20:44:29 +0000 | [diff] [blame] | 45 | static const char* GetCommandString(DrawType type); |
| 46 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 47 | protected: |
| 48 | DrawType fDrawType; |
chudy@google.com | 97cee97 | 2012-08-07 20:41:37 +0000 | [diff] [blame] | 49 | SkTDArray<SkString*> fInfo; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 50 | |
| 51 | private: |
| 52 | bool fVisible; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | class Restore : public SkDrawCommand { |
| 56 | public: |
| 57 | Restore(); |
| 58 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 59 | virtual void trackSaveState(int* state) SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | class Clear : public SkDrawCommand { |
| 63 | public: |
| 64 | Clear(SkColor color); |
| 65 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 66 | private: |
| 67 | SkColor fColor; |
| 68 | }; |
| 69 | |
| 70 | class ClipPath : public SkDrawCommand { |
| 71 | public: |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 72 | ClipPath(const SkPath& path, SkRegion::Op op, bool doAA, SkBitmap& bitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 73 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 74 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 75 | private: |
| 76 | const SkPath* fPath; |
| 77 | SkRegion::Op fOp; |
| 78 | bool fDoAA; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 79 | SkBitmap fBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | class ClipRegion : public SkDrawCommand { |
| 83 | public: |
| 84 | ClipRegion(const SkRegion& region, SkRegion::Op op); |
| 85 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 86 | private: |
| 87 | const SkRegion* fRegion; |
| 88 | SkRegion::Op fOp; |
| 89 | }; |
| 90 | |
| 91 | class ClipRect : public SkDrawCommand { |
| 92 | public: |
| 93 | ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); |
| 94 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame^] | 95 | |
| 96 | const SkRect& rect() const { return *fRect; } |
| 97 | SkRegion::Op op() const { return fOp; } |
| 98 | bool doAA() const { return fDoAA; } |
| 99 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 100 | private: |
| 101 | const SkRect* fRect; |
| 102 | SkRegion::Op fOp; |
| 103 | bool fDoAA; |
| 104 | }; |
| 105 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 106 | class ClipRRect : public SkDrawCommand { |
| 107 | public: |
| 108 | ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
| 109 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame^] | 110 | |
| 111 | const SkRRect& rrect() const { return fRRect; } |
| 112 | SkRegion::Op op() const { return fOp; } |
| 113 | bool doAA() const { return fDoAA; } |
| 114 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 115 | private: |
robertphillips@google.com | 2da95b2 | 2013-01-17 16:07:04 +0000 | [diff] [blame] | 116 | SkRRect fRRect; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 117 | SkRegion::Op fOp; |
| 118 | bool fDoAA; |
| 119 | }; |
| 120 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 121 | class Concat : public SkDrawCommand { |
| 122 | public: |
| 123 | Concat(const SkMatrix& matrix); |
| 124 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 125 | private: |
| 126 | const SkMatrix* fMatrix; |
| 127 | }; |
| 128 | |
| 129 | class DrawBitmap : public SkDrawCommand { |
| 130 | public: |
| 131 | DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 132 | const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 133 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 134 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 135 | private: |
| 136 | const SkPaint* fPaint; |
| 137 | const SkBitmap* fBitmap; |
| 138 | SkScalar fLeft; |
| 139 | SkScalar fTop; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 140 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 141 | }; |
| 142 | |
| 143 | class DrawBitmapMatrix : public SkDrawCommand { |
| 144 | public: |
| 145 | DrawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 146 | const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 147 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 148 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 149 | private: |
| 150 | const SkPaint* fPaint; |
| 151 | const SkBitmap* fBitmap; |
| 152 | const SkMatrix* fMatrix; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 153 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 154 | }; |
| 155 | |
| 156 | class DrawBitmapNine : public SkDrawCommand { |
| 157 | public: |
| 158 | DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 159 | const SkRect& dst, const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 160 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 161 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 162 | private: |
| 163 | const SkBitmap* fBitmap; |
| 164 | const SkIRect* fCenter; |
| 165 | const SkRect* fDst; |
| 166 | const SkPaint* fPaint; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 167 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | class DrawBitmapRect : public SkDrawCommand { |
| 171 | public: |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 172 | DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 173 | const SkRect& dst, const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 174 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 175 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 176 | |
| 177 | // The non-const 'paint' method allows modification of this object's |
| 178 | // SkPaint. For this reason the ctor and setPaint method make a local copy. |
| 179 | // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
| 180 | // (since only an SkPaint* is passed into the ctor). |
| 181 | const SkPaint* paint() const { return fPaintPtr; } |
| 182 | SkPaint* paint() { return fPaintPtr; } |
| 183 | |
| 184 | void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
| 185 | |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame^] | 186 | const SkRect& dstRect() { return *fDst; } |
| 187 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 188 | private: |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 189 | const SkRect* fSrc; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 190 | SkPaint fPaint; |
| 191 | SkPaint* fPaintPtr; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 192 | const SkBitmap* fBitmap; |
| 193 | const SkRect* fDst; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 194 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 195 | }; |
| 196 | |
| 197 | class DrawData : public SkDrawCommand { |
| 198 | public: |
| 199 | DrawData(const void* data, size_t length); |
| 200 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 201 | private: |
| 202 | const void* fData; |
| 203 | size_t fLength; |
| 204 | }; |
| 205 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 206 | class DrawOval : public SkDrawCommand { |
| 207 | public: |
| 208 | DrawOval(const SkRect& oval, const SkPaint& paint); |
| 209 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 210 | private: |
| 211 | const SkRect* fOval; |
| 212 | const SkPaint* fPaint; |
| 213 | }; |
| 214 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 215 | class DrawPaint : public SkDrawCommand { |
| 216 | public: |
| 217 | DrawPaint(const SkPaint& paint); |
| 218 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 219 | private: |
| 220 | const SkPaint* fPaint; |
| 221 | }; |
| 222 | |
| 223 | class DrawPath : public SkDrawCommand { |
| 224 | public: |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 225 | DrawPath(const SkPath& path, const SkPaint& paint, SkBitmap& bitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 226 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
rmistry@google.com | 4473765 | 2012-11-21 18:37:58 +0000 | [diff] [blame] | 227 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 228 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 229 | private: |
| 230 | const SkPath* fPath; |
| 231 | const SkPaint* fPaint; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 232 | SkBitmap fBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 233 | }; |
| 234 | |
| 235 | class DrawPicture : public SkDrawCommand { |
| 236 | public: |
| 237 | DrawPicture(SkPicture& picture); |
| 238 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 239 | private: |
| 240 | SkPicture* fPicture; |
| 241 | }; |
| 242 | |
| 243 | class DrawPoints : public SkDrawCommand { |
| 244 | public: |
| 245 | DrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], |
| 246 | const SkPaint& paint); |
| 247 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 248 | private: |
| 249 | const SkPoint* fPts; |
| 250 | SkCanvas::PointMode fMode; |
| 251 | size_t fCount; |
| 252 | const SkPaint* fPaint; |
| 253 | }; |
| 254 | |
| 255 | /* TODO(chudy): DrawText is a predefined macro and was breaking something |
| 256 | * in the windows build of the debugger. |
| 257 | */ |
| 258 | class DrawTextC : public SkDrawCommand { |
| 259 | public: |
| 260 | DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
| 261 | const SkPaint& paint); |
| 262 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 263 | private: |
| 264 | const void* fText; |
| 265 | size_t fByteLength; |
| 266 | SkScalar fX; |
| 267 | SkScalar fY; |
| 268 | const SkPaint* fPaint; |
| 269 | }; |
| 270 | |
| 271 | class DrawPosText : public SkDrawCommand { |
| 272 | public: |
| 273 | DrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
| 274 | const SkPaint& paint); |
| 275 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 276 | private: |
| 277 | const SkPoint* fPos; |
| 278 | const void* fText; |
| 279 | size_t fByteLength; |
| 280 | const SkPaint* fPaint; |
| 281 | }; |
| 282 | |
| 283 | class DrawTextOnPath : public SkDrawCommand { |
| 284 | public: |
| 285 | DrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
| 286 | const SkMatrix* matrix, const SkPaint& paint); |
| 287 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 288 | private: |
| 289 | const SkMatrix* fMatrix; |
| 290 | const void* fText; |
| 291 | size_t fByteLength; |
| 292 | const SkPath* fPath; |
| 293 | const SkPaint* fPaint; |
| 294 | }; |
| 295 | |
| 296 | class DrawPosTextH : public SkDrawCommand { |
| 297 | public: |
| 298 | DrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], |
| 299 | SkScalar constY, const SkPaint& paint); |
| 300 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 301 | private: |
| 302 | const SkScalar* fXpos; |
| 303 | const void* fText; |
| 304 | size_t fByteLength; |
| 305 | SkScalar fConstY; |
| 306 | const SkPaint* fPaint; |
| 307 | }; |
| 308 | |
| 309 | class DrawRectC : public SkDrawCommand { |
| 310 | public: |
| 311 | DrawRectC(const SkRect& rect, const SkPaint& paint); |
| 312 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame^] | 313 | |
| 314 | const SkRect& rect() const { return *fRect; } |
| 315 | const SkPaint* paint() const { return fPaint; } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 316 | private: |
| 317 | const SkRect* fRect; |
| 318 | const SkPaint* fPaint; |
| 319 | }; |
| 320 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 321 | class DrawRRect : public SkDrawCommand { |
| 322 | public: |
| 323 | DrawRRect(const SkRRect& rrect, const SkPaint& paint); |
| 324 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 325 | private: |
| 326 | SkRRect fRRect; |
robertphillips@google.com | febc0ec | 2013-03-11 22:53:11 +0000 | [diff] [blame^] | 327 | SkPaint fPaint; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 328 | }; |
| 329 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 330 | class DrawSprite : public SkDrawCommand { |
| 331 | public: |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 332 | DrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint, |
| 333 | SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 334 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 335 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 336 | private: |
| 337 | const SkPaint* fPaint; |
| 338 | int fLeft; |
| 339 | int fTop; |
| 340 | const SkBitmap* fBitmap; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 341 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 342 | }; |
| 343 | |
| 344 | class DrawVertices : public SkDrawCommand { |
| 345 | public: |
| 346 | DrawVertices(SkCanvas::VertexMode vmode, int vertexCount, |
| 347 | const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], |
| 348 | SkXfermode* xfermode, const uint16_t indices[], int indexCount, |
| 349 | const SkPaint& paint); |
| 350 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 351 | private: |
| 352 | SkCanvas::VertexMode fVmode; |
| 353 | int fVertexCount; |
| 354 | int fIndexCount; |
| 355 | const SkPoint* fVertices; |
| 356 | const SkPoint* fTexs; |
| 357 | const SkColor* fColors; |
| 358 | const uint16_t* fIndices; |
| 359 | SkXfermode* fXfermode; |
| 360 | const SkPaint* fPaint; |
| 361 | }; |
| 362 | |
| 363 | class Rotate : public SkDrawCommand { |
| 364 | public: |
| 365 | Rotate(SkScalar degrees); |
| 366 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 367 | private: |
| 368 | SkScalar fDegrees; |
| 369 | }; |
| 370 | |
| 371 | class Save : public SkDrawCommand { |
| 372 | public: |
| 373 | Save(SkCanvas::SaveFlags flags); |
| 374 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 375 | virtual void trackSaveState(int* state) SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 376 | private: |
| 377 | SkCanvas::SaveFlags fFlags; |
| 378 | }; |
| 379 | |
| 380 | class SaveLayer : public SkDrawCommand { |
| 381 | public: |
| 382 | SaveLayer(const SkRect* bounds, const SkPaint* paint, |
| 383 | SkCanvas::SaveFlags flags); |
| 384 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 385 | virtual void trackSaveState(int* state) SK_OVERRIDE; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 386 | |
| 387 | const SkPaint* paint() const { return fPaint; } |
| 388 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 389 | private: |
| 390 | const SkRect* fBounds; |
| 391 | const SkPaint* fPaint; |
| 392 | SkCanvas::SaveFlags fFlags; |
| 393 | }; |
| 394 | |
| 395 | class Scale : public SkDrawCommand { |
| 396 | public: |
| 397 | Scale(SkScalar sx, SkScalar sy); |
| 398 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 399 | private: |
| 400 | SkScalar fSx; |
| 401 | SkScalar fSy; |
| 402 | }; |
| 403 | |
| 404 | class SetMatrix : public SkDrawCommand { |
| 405 | public: |
| 406 | SetMatrix(const SkMatrix& matrix); |
| 407 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 408 | private: |
robertphillips@google.com | b94b1e7 | 2013-02-19 21:00:26 +0000 | [diff] [blame] | 409 | SkMatrix fMatrix; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 410 | }; |
| 411 | |
| 412 | class Skew : public SkDrawCommand { |
| 413 | public: |
| 414 | Skew(SkScalar sx, SkScalar sy); |
| 415 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 416 | private: |
| 417 | SkScalar fSx; |
| 418 | SkScalar fSy; |
| 419 | }; |
| 420 | |
| 421 | class Translate : public SkDrawCommand { |
| 422 | public: |
| 423 | Translate(SkScalar dx, SkScalar dy); |
| 424 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 425 | private: |
| 426 | SkScalar fDx; |
| 427 | SkScalar fDy; |
| 428 | }; |
| 429 | |
| 430 | #endif |