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; |
| 95 | private: |
| 96 | const SkRect* fRect; |
| 97 | SkRegion::Op fOp; |
| 98 | bool fDoAA; |
| 99 | }; |
| 100 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 101 | class ClipRRect : public SkDrawCommand { |
| 102 | public: |
| 103 | ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA); |
| 104 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 105 | private: |
robertphillips@google.com | 2da95b2 | 2013-01-17 16:07:04 +0000 | [diff] [blame] | 106 | SkRRect fRRect; |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 107 | SkRegion::Op fOp; |
| 108 | bool fDoAA; |
| 109 | }; |
| 110 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 111 | class Concat : public SkDrawCommand { |
| 112 | public: |
| 113 | Concat(const SkMatrix& matrix); |
| 114 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 115 | private: |
| 116 | const SkMatrix* fMatrix; |
| 117 | }; |
| 118 | |
| 119 | class DrawBitmap : public SkDrawCommand { |
| 120 | public: |
| 121 | DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 122 | const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 123 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 124 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 125 | private: |
| 126 | const SkPaint* fPaint; |
| 127 | const SkBitmap* fBitmap; |
| 128 | SkScalar fLeft; |
| 129 | SkScalar fTop; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 130 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 131 | }; |
| 132 | |
| 133 | class DrawBitmapMatrix : public SkDrawCommand { |
| 134 | public: |
| 135 | DrawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 136 | const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 137 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 138 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 139 | private: |
| 140 | const SkPaint* fPaint; |
| 141 | const SkBitmap* fBitmap; |
| 142 | const SkMatrix* fMatrix; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 143 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | class DrawBitmapNine : public SkDrawCommand { |
| 147 | public: |
| 148 | DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 149 | const SkRect& dst, const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 150 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 151 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 152 | private: |
| 153 | const SkBitmap* fBitmap; |
| 154 | const SkIRect* fCenter; |
| 155 | const SkRect* fDst; |
| 156 | const SkPaint* fPaint; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 157 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | class DrawBitmapRect : public SkDrawCommand { |
| 161 | public: |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 162 | DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 163 | const SkRect& dst, const SkPaint* paint, SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 164 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 165 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 166 | |
| 167 | // The non-const 'paint' method allows modification of this object's |
| 168 | // SkPaint. For this reason the ctor and setPaint method make a local copy. |
| 169 | // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
| 170 | // (since only an SkPaint* is passed into the ctor). |
| 171 | const SkPaint* paint() const { return fPaintPtr; } |
| 172 | SkPaint* paint() { return fPaintPtr; } |
| 173 | |
| 174 | void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
| 175 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 176 | private: |
reed@google.com | 7112173 | 2012-09-18 15:14:33 +0000 | [diff] [blame] | 177 | const SkRect* fSrc; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 178 | SkPaint fPaint; |
| 179 | SkPaint* fPaintPtr; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 180 | const SkBitmap* fBitmap; |
| 181 | const SkRect* fDst; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 182 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 183 | }; |
| 184 | |
| 185 | class DrawData : public SkDrawCommand { |
| 186 | public: |
| 187 | DrawData(const void* data, size_t length); |
| 188 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 189 | private: |
| 190 | const void* fData; |
| 191 | size_t fLength; |
| 192 | }; |
| 193 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 194 | class DrawOval : public SkDrawCommand { |
| 195 | public: |
| 196 | DrawOval(const SkRect& oval, const SkPaint& paint); |
| 197 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 198 | private: |
| 199 | const SkRect* fOval; |
| 200 | const SkPaint* fPaint; |
| 201 | }; |
| 202 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 203 | class DrawPaint : public SkDrawCommand { |
| 204 | public: |
| 205 | DrawPaint(const SkPaint& paint); |
| 206 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 207 | private: |
| 208 | const SkPaint* fPaint; |
| 209 | }; |
| 210 | |
| 211 | class DrawPath : public SkDrawCommand { |
| 212 | public: |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 213 | DrawPath(const SkPath& path, const SkPaint& paint, SkBitmap& bitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 214 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
rmistry@google.com | 4473765 | 2012-11-21 18:37:58 +0000 | [diff] [blame] | 215 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 216 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 217 | private: |
| 218 | const SkPath* fPath; |
| 219 | const SkPaint* fPaint; |
robertphillips@google.com | 6dec8fc | 2012-11-21 17:11:02 +0000 | [diff] [blame] | 220 | SkBitmap fBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 221 | }; |
| 222 | |
| 223 | class DrawPicture : public SkDrawCommand { |
| 224 | public: |
| 225 | DrawPicture(SkPicture& picture); |
| 226 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 227 | private: |
| 228 | SkPicture* fPicture; |
| 229 | }; |
| 230 | |
| 231 | class DrawPoints : public SkDrawCommand { |
| 232 | public: |
| 233 | DrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], |
| 234 | const SkPaint& paint); |
| 235 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 236 | private: |
| 237 | const SkPoint* fPts; |
| 238 | SkCanvas::PointMode fMode; |
| 239 | size_t fCount; |
| 240 | const SkPaint* fPaint; |
| 241 | }; |
| 242 | |
| 243 | /* TODO(chudy): DrawText is a predefined macro and was breaking something |
| 244 | * in the windows build of the debugger. |
| 245 | */ |
| 246 | class DrawTextC : public SkDrawCommand { |
| 247 | public: |
| 248 | DrawTextC(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
| 249 | const SkPaint& paint); |
| 250 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 251 | private: |
| 252 | const void* fText; |
| 253 | size_t fByteLength; |
| 254 | SkScalar fX; |
| 255 | SkScalar fY; |
| 256 | const SkPaint* fPaint; |
| 257 | }; |
| 258 | |
| 259 | class DrawPosText : public SkDrawCommand { |
| 260 | public: |
| 261 | DrawPosText(const void* text, size_t byteLength, const SkPoint pos[], |
| 262 | const SkPaint& paint); |
| 263 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 264 | private: |
| 265 | const SkPoint* fPos; |
| 266 | const void* fText; |
| 267 | size_t fByteLength; |
| 268 | const SkPaint* fPaint; |
| 269 | }; |
| 270 | |
| 271 | class DrawTextOnPath : public SkDrawCommand { |
| 272 | public: |
| 273 | DrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, |
| 274 | const SkMatrix* matrix, const SkPaint& paint); |
| 275 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 276 | private: |
| 277 | const SkMatrix* fMatrix; |
| 278 | const void* fText; |
| 279 | size_t fByteLength; |
| 280 | const SkPath* fPath; |
| 281 | const SkPaint* fPaint; |
| 282 | }; |
| 283 | |
| 284 | class DrawPosTextH : public SkDrawCommand { |
| 285 | public: |
| 286 | DrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], |
| 287 | SkScalar constY, const SkPaint& paint); |
| 288 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 289 | private: |
| 290 | const SkScalar* fXpos; |
| 291 | const void* fText; |
| 292 | size_t fByteLength; |
| 293 | SkScalar fConstY; |
| 294 | const SkPaint* fPaint; |
| 295 | }; |
| 296 | |
| 297 | class DrawRectC : public SkDrawCommand { |
| 298 | public: |
| 299 | DrawRectC(const SkRect& rect, const SkPaint& paint); |
| 300 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 301 | private: |
| 302 | const SkRect* fRect; |
| 303 | const SkPaint* fPaint; |
| 304 | }; |
| 305 | |
robertphillips@google.com | 67baba4 | 2013-01-02 20:20:31 +0000 | [diff] [blame] | 306 | class DrawRRect : public SkDrawCommand { |
| 307 | public: |
| 308 | DrawRRect(const SkRRect& rrect, const SkPaint& paint); |
| 309 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 310 | private: |
| 311 | SkRRect fRRect; |
| 312 | const SkPaint* fPaint; |
| 313 | }; |
| 314 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 315 | class DrawSprite : public SkDrawCommand { |
| 316 | public: |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 317 | DrawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint, |
| 318 | SkBitmap& resizedBitmap); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 319 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 320 | virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 321 | private: |
| 322 | const SkPaint* fPaint; |
| 323 | int fLeft; |
| 324 | int fTop; |
| 325 | const SkBitmap* fBitmap; |
robertphillips@google.com | 53ec73d | 2012-11-26 13:09:17 +0000 | [diff] [blame] | 326 | SkBitmap fResizedBitmap; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 327 | }; |
| 328 | |
| 329 | class DrawVertices : public SkDrawCommand { |
| 330 | public: |
| 331 | DrawVertices(SkCanvas::VertexMode vmode, int vertexCount, |
| 332 | const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], |
| 333 | SkXfermode* xfermode, const uint16_t indices[], int indexCount, |
| 334 | const SkPaint& paint); |
| 335 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 336 | private: |
| 337 | SkCanvas::VertexMode fVmode; |
| 338 | int fVertexCount; |
| 339 | int fIndexCount; |
| 340 | const SkPoint* fVertices; |
| 341 | const SkPoint* fTexs; |
| 342 | const SkColor* fColors; |
| 343 | const uint16_t* fIndices; |
| 344 | SkXfermode* fXfermode; |
| 345 | const SkPaint* fPaint; |
| 346 | }; |
| 347 | |
| 348 | class Rotate : public SkDrawCommand { |
| 349 | public: |
| 350 | Rotate(SkScalar degrees); |
| 351 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 352 | private: |
| 353 | SkScalar fDegrees; |
| 354 | }; |
| 355 | |
| 356 | class Save : public SkDrawCommand { |
| 357 | public: |
| 358 | Save(SkCanvas::SaveFlags flags); |
| 359 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 360 | virtual void trackSaveState(int* state) SK_OVERRIDE; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 361 | private: |
| 362 | SkCanvas::SaveFlags fFlags; |
| 363 | }; |
| 364 | |
| 365 | class SaveLayer : public SkDrawCommand { |
| 366 | public: |
| 367 | SaveLayer(const SkRect* bounds, const SkPaint* paint, |
| 368 | SkCanvas::SaveFlags flags); |
| 369 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
tomhudson@google.com | 0699e02 | 2012-11-27 16:09:42 +0000 | [diff] [blame] | 370 | virtual void trackSaveState(int* state) SK_OVERRIDE; |
robertphillips@google.com | 3b0a9fe | 2013-01-31 15:56:22 +0000 | [diff] [blame] | 371 | |
| 372 | const SkPaint* paint() const { return fPaint; } |
| 373 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 374 | private: |
| 375 | const SkRect* fBounds; |
| 376 | const SkPaint* fPaint; |
| 377 | SkCanvas::SaveFlags fFlags; |
| 378 | }; |
| 379 | |
| 380 | class Scale : public SkDrawCommand { |
| 381 | public: |
| 382 | Scale(SkScalar sx, SkScalar sy); |
| 383 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 384 | private: |
| 385 | SkScalar fSx; |
| 386 | SkScalar fSy; |
| 387 | }; |
| 388 | |
| 389 | class SetMatrix : public SkDrawCommand { |
| 390 | public: |
| 391 | SetMatrix(const SkMatrix& matrix); |
| 392 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 393 | private: |
robertphillips@google.com | b94b1e7 | 2013-02-19 21:00:26 +0000 | [diff] [blame^] | 394 | SkMatrix fMatrix; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 395 | }; |
| 396 | |
| 397 | class Skew : public SkDrawCommand { |
| 398 | public: |
| 399 | Skew(SkScalar sx, SkScalar sy); |
| 400 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 401 | private: |
| 402 | SkScalar fSx; |
| 403 | SkScalar fSy; |
| 404 | }; |
| 405 | |
| 406 | class Translate : public SkDrawCommand { |
| 407 | public: |
| 408 | Translate(SkScalar dx, SkScalar dy); |
| 409 | virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
| 410 | private: |
| 411 | SkScalar fDx; |
| 412 | SkScalar fDy; |
| 413 | }; |
| 414 | |
| 415 | #endif |