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 kBeginCommentGroup_OpType, | 18 kBeginCommentGroup_OpType, |
| 19 kBeginDrawPicture_OpType, |
19 kClipPath_OpType, | 20 kClipPath_OpType, |
20 kClipRegion_OpType, | 21 kClipRegion_OpType, |
21 kClipRect_OpType, | 22 kClipRect_OpType, |
22 kClipRRect_OpType, | 23 kClipRRect_OpType, |
23 kComment_OpType, | 24 kComment_OpType, |
24 kConcat_OpType, | 25 kConcat_OpType, |
25 kDrawBitmap_OpType, | 26 kDrawBitmap_OpType, |
26 kDrawBitmapNine_OpType, | 27 kDrawBitmapNine_OpType, |
27 kDrawBitmapRect_OpType, | 28 kDrawBitmapRect_OpType, |
28 kDrawClear_OpType, | 29 kDrawClear_OpType, |
29 kDrawDRRect_OpType, | 30 kDrawDRRect_OpType, |
30 kDrawOval_OpType, | 31 kDrawOval_OpType, |
31 kDrawPaint_OpType, | 32 kDrawPaint_OpType, |
32 kDrawPatch_OpType, | 33 kDrawPatch_OpType, |
33 kDrawPath_OpType, | 34 kDrawPath_OpType, |
34 kDrawPicture_OpType, | |
35 kDrawPoints_OpType, | 35 kDrawPoints_OpType, |
36 kDrawPosText_OpType, | 36 kDrawPosText_OpType, |
37 kDrawPosTextH_OpType, | 37 kDrawPosTextH_OpType, |
38 kDrawRect_OpType, | 38 kDrawRect_OpType, |
39 kDrawRRect_OpType, | 39 kDrawRRect_OpType, |
40 kDrawSprite_OpType, | 40 kDrawSprite_OpType, |
41 kDrawText_OpType, | 41 kDrawText_OpType, |
42 kDrawTextBlob_OpType, | 42 kDrawTextBlob_OpType, |
43 kDrawTextOnPath_OpType, | 43 kDrawTextOnPath_OpType, |
44 kDrawVertices_OpType, | 44 kDrawVertices_OpType, |
45 kEndCommentGroup_OpType, | 45 kEndCommentGroup_OpType, |
| 46 kEndDrawPicture_OpType, |
46 kRestore_OpType, | 47 kRestore_OpType, |
47 kSave_OpType, | 48 kSave_OpType, |
48 kSaveLayer_OpType, | 49 kSaveLayer_OpType, |
49 kSetMatrix_OpType, | 50 kSetMatrix_OpType, |
50 | 51 |
51 kLast_OpType = kSetMatrix_OpType | 52 kLast_OpType = kSetMatrix_OpType |
52 }; | 53 }; |
53 | 54 |
54 static const int kOpTypeCount = kLast_OpType + 1; | 55 static const int kOpTypeCount = kLast_OpType + 1; |
55 | 56 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 void execute(SkCanvas* canvas) const override; | 331 void execute(SkCanvas* canvas) const override; |
331 bool render(SkCanvas* canvas) const override; | 332 bool render(SkCanvas* canvas) const override; |
332 | 333 |
333 private: | 334 private: |
334 SkPath fPath; | 335 SkPath fPath; |
335 SkPaint fPaint; | 336 SkPaint fPaint; |
336 | 337 |
337 typedef SkDrawCommand INHERITED; | 338 typedef SkDrawCommand INHERITED; |
338 }; | 339 }; |
339 | 340 |
340 class SkDrawPictureCommand : public SkDrawCommand { | 341 class SkBeginDrawPictureCommand : public SkDrawCommand { |
341 public: | 342 public: |
342 SkDrawPictureCommand(const SkPicture* picture, const SkMatrix* matrix, const
SkPaint* paint); | 343 SkBeginDrawPictureCommand(const SkPicture* picture, |
| 344 const SkMatrix* matrix, |
| 345 const SkPaint* paint); |
| 346 |
343 void execute(SkCanvas* canvas) const override; | 347 void execute(SkCanvas* canvas) const override; |
344 bool render(SkCanvas* canvas) const override; | 348 bool render(SkCanvas* canvas) const override; |
345 | 349 |
346 private: | 350 private: |
347 SkAutoTUnref<const SkPicture> fPicture; | 351 SkAutoTUnref<const SkPicture> fPicture; |
348 SkMatrix fMatrix; | 352 SkTLazy<SkMatrix> fMatrix; |
349 SkMatrix* fMatrixPtr; | 353 SkTLazy<SkPaint> fPaint; |
350 SkPaint fPaint; | |
351 SkPaint* fPaintPtr; | |
352 | 354 |
353 typedef SkDrawCommand INHERITED; | 355 typedef SkDrawCommand INHERITED; |
354 }; | 356 }; |
| 357 |
| 358 class SkEndDrawPictureCommand : public SkDrawCommand { |
| 359 public: |
| 360 SkEndDrawPictureCommand(bool restore); |
| 361 |
| 362 void execute(SkCanvas* canvas) const override; |
| 363 |
| 364 private: |
| 365 bool fRestore; |
| 366 |
| 367 typedef SkDrawCommand INHERITED; |
| 368 }; |
355 | 369 |
356 class SkDrawPointsCommand : public SkDrawCommand { | 370 class SkDrawPointsCommand : public SkDrawCommand { |
357 public: | 371 public: |
358 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], | 372 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], |
359 const SkPaint& paint); | 373 const SkPaint& paint); |
360 virtual ~SkDrawPointsCommand() { delete [] fPts; } | 374 virtual ~SkDrawPointsCommand() { delete [] fPts; } |
361 void execute(SkCanvas* canvas) const override; | 375 void execute(SkCanvas* canvas) const override; |
362 bool render(SkCanvas* canvas) const override; | 376 bool render(SkCanvas* canvas) const override; |
363 private: | 377 private: |
364 SkCanvas::PointMode fMode; | 378 SkCanvas::PointMode fMode; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 void setUserMatrix(const SkMatrix&) override; | 596 void setUserMatrix(const SkMatrix&) override; |
583 void execute(SkCanvas* canvas) const override; | 597 void execute(SkCanvas* canvas) const override; |
584 private: | 598 private: |
585 SkMatrix fUserMatrix; | 599 SkMatrix fUserMatrix; |
586 SkMatrix fMatrix; | 600 SkMatrix fMatrix; |
587 | 601 |
588 typedef SkDrawCommand INHERITED; | 602 typedef SkDrawCommand INHERITED; |
589 }; | 603 }; |
590 | 604 |
591 #endif | 605 #endif |
OLD | NEW |