OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SKDRAWCOMMAND_H_ | 9 #ifndef SKDRAWCOMMAND_H_ |
10 #define SKDRAWCOMMAND_H_ | 10 #define SKDRAWCOMMAND_H_ |
11 | 11 |
12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
13 #include "SkString.h" | 13 #include "SkString.h" |
14 | 14 |
15 class SK_API SkDrawCommand { | 15 class SK_API SkDrawCommand { |
16 public: | 16 public: |
17 enum OpType { | 17 enum OpType { |
18 kBeginDrawPicture_OpType, | 18 kBeginDrawPicture_OpType, |
19 kClipPath_OpType, | 19 kClipPath_OpType, |
20 kClipRegion_OpType, | 20 kClipRegion_OpType, |
21 kClipRect_OpType, | 21 kClipRect_OpType, |
22 kClipRRect_OpType, | 22 kClipRRect_OpType, |
23 kConcat_OpType, | 23 kConcat_OpType, |
24 kDrawBitmap_OpType, | 24 kDrawBitmap_OpType, |
25 kDrawBitmapNine_OpType, | 25 kDrawBitmapNine_OpType, |
26 kDrawBitmapRect_OpType, | 26 kDrawBitmapRect_OpType, |
27 kDrawClear_OpType, | 27 kDrawClear_OpType, |
28 kDrawDRRect_OpType, | 28 kDrawDRRect_OpType, |
| 29 kDrawImage_OpType, |
| 30 kDrawImageRect_OpType, |
29 kDrawOval_OpType, | 31 kDrawOval_OpType, |
30 kDrawPaint_OpType, | 32 kDrawPaint_OpType, |
31 kDrawPatch_OpType, | 33 kDrawPatch_OpType, |
32 kDrawPath_OpType, | 34 kDrawPath_OpType, |
33 kDrawPoints_OpType, | 35 kDrawPoints_OpType, |
34 kDrawPosText_OpType, | 36 kDrawPosText_OpType, |
35 kDrawPosTextH_OpType, | 37 kDrawPosTextH_OpType, |
36 kDrawRect_OpType, | 38 kDrawRect_OpType, |
37 kDrawRRect_OpType, | 39 kDrawRRect_OpType, |
38 kDrawSprite_OpType, | 40 kDrawSprite_OpType, |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 SkBitmap fBitmap; | 259 SkBitmap fBitmap; |
258 SkRect fSrc; | 260 SkRect fSrc; |
259 SkRect fDst; | 261 SkRect fDst; |
260 SkPaint fPaint; | 262 SkPaint fPaint; |
261 SkPaint* fPaintPtr; | 263 SkPaint* fPaintPtr; |
262 SkCanvas::SrcRectConstraint fConstraint; | 264 SkCanvas::SrcRectConstraint fConstraint; |
263 | 265 |
264 typedef SkDrawCommand INHERITED; | 266 typedef SkDrawCommand INHERITED; |
265 }; | 267 }; |
266 | 268 |
| 269 class SkDrawImageCommand : public SkDrawCommand { |
| 270 public: |
| 271 SkDrawImageCommand(const SkImage* image, SkScalar left, SkScalar top, const
SkPaint* paint); |
| 272 void execute(SkCanvas* canvas) const override; |
| 273 bool render(SkCanvas* canvas) const override; |
| 274 private: |
| 275 SkAutoTUnref<const SkImage> fImage; |
| 276 SkScalar fLeft; |
| 277 SkScalar fTop; |
| 278 SkTLazy<SkPaint> fPaint; |
| 279 |
| 280 typedef SkDrawCommand INHERITED; |
| 281 }; |
| 282 |
| 283 class SkDrawImageRectCommand : public SkDrawCommand { |
| 284 public: |
| 285 SkDrawImageRectCommand(const SkImage* image, const SkRect* src, const SkRect
& dst, |
| 286 const SkPaint* paint, SkCanvas::SrcRectConstraint con
straint); |
| 287 void execute(SkCanvas* canvas) const override; |
| 288 bool render(SkCanvas* canvas) const override; |
| 289 private: |
| 290 SkAutoTUnref<const SkImage> fImage; |
| 291 SkTLazy<SkRect> fSrc; |
| 292 SkRect fDst; |
| 293 SkTLazy<SkPaint> fPaint; |
| 294 SkCanvas::SrcRectConstraint fConstraint; |
| 295 |
| 296 typedef SkDrawCommand INHERITED; |
| 297 }; |
| 298 |
267 class SkDrawOvalCommand : public SkDrawCommand { | 299 class SkDrawOvalCommand : public SkDrawCommand { |
268 public: | 300 public: |
269 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); | 301 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |
270 void execute(SkCanvas* canvas) const override; | 302 void execute(SkCanvas* canvas) const override; |
271 bool render(SkCanvas* canvas) const override; | 303 bool render(SkCanvas* canvas) const override; |
272 private: | 304 private: |
273 SkRect fOval; | 305 SkRect fOval; |
274 SkPaint fPaint; | 306 SkPaint fPaint; |
275 | 307 |
276 typedef SkDrawCommand INHERITED; | 308 typedef SkDrawCommand INHERITED; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 void setUserMatrix(const SkMatrix&) override; | 590 void setUserMatrix(const SkMatrix&) override; |
559 void execute(SkCanvas* canvas) const override; | 591 void execute(SkCanvas* canvas) const override; |
560 private: | 592 private: |
561 SkMatrix fUserMatrix; | 593 SkMatrix fUserMatrix; |
562 SkMatrix fMatrix; | 594 SkMatrix fMatrix; |
563 | 595 |
564 typedef SkDrawCommand INHERITED; | 596 typedef SkDrawCommand INHERITED; |
565 }; | 597 }; |
566 | 598 |
567 #endif | 599 #endif |
OLD | NEW |