OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SKDRAWCOMMAND_H_ | 8 #ifndef SKDRAWCOMMAND_H_ |
9 #define SKDRAWCOMMAND_H_ | 9 #define SKDRAWCOMMAND_H_ |
10 | 10 |
11 #include "png.h" | 11 #include "png.h" |
12 | 12 |
13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
14 #include "SkTLazy.h" | 14 #include "SkTLazy.h" |
15 #include "SkPath.h" | 15 #include "SkPath.h" |
16 #include "SkRRect.h" | 16 #include "SkRRect.h" |
17 #include "SkRSXform.h" | 17 #include "SkRSXform.h" |
18 #include "SkString.h" | 18 #include "SkString.h" |
19 #include "SkTDArray.h" | 19 #include "SkTDArray.h" |
20 #include "SkJSONCPP.h" | 20 #include "SkJSONCPP.h" |
21 #include "UrlDataManager.h" | 21 #include "UrlDataManager.h" |
22 | 22 |
23 class SK_API SkDrawCommand { | 23 class SK_API SkDrawCommand { |
24 public: | 24 public: |
25 enum OpType { | 25 enum OpType { |
26 kBeginDrawPicture_OpType, | 26 kBeginDrawPicture_OpType, |
| 27 kBeginDrawShadowedPicture_OpType, |
27 kClipPath_OpType, | 28 kClipPath_OpType, |
28 kClipRegion_OpType, | 29 kClipRegion_OpType, |
29 kClipRect_OpType, | 30 kClipRect_OpType, |
30 kClipRRect_OpType, | 31 kClipRRect_OpType, |
31 kConcat_OpType, | 32 kConcat_OpType, |
32 kDrawAnnotation_OpType, | 33 kDrawAnnotation_OpType, |
33 kDrawBitmap_OpType, | 34 kDrawBitmap_OpType, |
34 kDrawBitmapNine_OpType, | 35 kDrawBitmapNine_OpType, |
35 kDrawBitmapRect_OpType, | 36 kDrawBitmapRect_OpType, |
36 kDrawClear_OpType, | 37 kDrawClear_OpType, |
37 kDrawDRRect_OpType, | 38 kDrawDRRect_OpType, |
38 kDrawImage_OpType, | 39 kDrawImage_OpType, |
39 kDrawImageRect_OpType, | 40 kDrawImageRect_OpType, |
40 kDrawOval_OpType, | 41 kDrawOval_OpType, |
41 kDrawPaint_OpType, | 42 kDrawPaint_OpType, |
42 kDrawPatch_OpType, | 43 kDrawPatch_OpType, |
43 kDrawPath_OpType, | 44 kDrawPath_OpType, |
44 kDrawPoints_OpType, | 45 kDrawPoints_OpType, |
45 kDrawPosText_OpType, | 46 kDrawPosText_OpType, |
46 kDrawPosTextH_OpType, | 47 kDrawPosTextH_OpType, |
47 kDrawRect_OpType, | 48 kDrawRect_OpType, |
48 kDrawRRect_OpType, | 49 kDrawRRect_OpType, |
49 kDrawText_OpType, | 50 kDrawText_OpType, |
50 kDrawTextBlob_OpType, | 51 kDrawTextBlob_OpType, |
51 kDrawTextOnPath_OpType, | 52 kDrawTextOnPath_OpType, |
52 kDrawTextRSXform_OpType, | 53 kDrawTextRSXform_OpType, |
53 kDrawVertices_OpType, | 54 kDrawVertices_OpType, |
54 kEndDrawPicture_OpType, | 55 kEndDrawPicture_OpType, |
| 56 kEndDrawShadowedPicture_OpType, |
55 kRestore_OpType, | 57 kRestore_OpType, |
56 kSave_OpType, | 58 kSave_OpType, |
57 kSaveLayer_OpType, | 59 kSaveLayer_OpType, |
58 kSetMatrix_OpType, | 60 kSetMatrix_OpType, |
59 kTranslateZ_OpType, | 61 kTranslateZ_OpType, |
60 | 62 |
61 kLast_OpType = kTranslateZ_OpType | 63 kLast_OpType = kTranslateZ_OpType |
62 }; | 64 }; |
63 | 65 |
64 static const int kOpTypeCount = kLast_OpType + 1; | 66 static const int kOpTypeCount = kLast_OpType + 1; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 SkEndDrawPictureCommand(bool restore); | 450 SkEndDrawPictureCommand(bool restore); |
449 | 451 |
450 void execute(SkCanvas* canvas) const override; | 452 void execute(SkCanvas* canvas) const override; |
451 | 453 |
452 private: | 454 private: |
453 bool fRestore; | 455 bool fRestore; |
454 | 456 |
455 typedef SkDrawCommand INHERITED; | 457 typedef SkDrawCommand INHERITED; |
456 }; | 458 }; |
457 | 459 |
| 460 class SkBeginDrawShadowedPictureCommand : public SkDrawCommand { |
| 461 public: |
| 462 SkBeginDrawShadowedPictureCommand(const SkPicture* picture, |
| 463 const SkMatrix* matrix, |
| 464 const SkPaint* paint); |
| 465 |
| 466 void execute(SkCanvas* canvas) const override; |
| 467 bool render(SkCanvas* canvas) const override; |
| 468 |
| 469 private: |
| 470 SkAutoTUnref<const SkPicture> fPicture; |
| 471 SkTLazy<SkMatrix> fMatrix; |
| 472 SkTLazy<SkPaint> fPaint; |
| 473 |
| 474 typedef SkDrawCommand INHERITED; |
| 475 }; |
| 476 |
| 477 class SkEndDrawShadowedPictureCommand : public SkDrawCommand { |
| 478 public: |
| 479 SkEndDrawShadowedPictureCommand(bool restore); |
| 480 |
| 481 void execute(SkCanvas* canvas) const override; |
| 482 |
| 483 private: |
| 484 bool fRestore; |
| 485 |
| 486 typedef SkDrawCommand INHERITED; |
| 487 }; |
| 488 |
458 class SkDrawPointsCommand : public SkDrawCommand { | 489 class SkDrawPointsCommand : public SkDrawCommand { |
459 public: | 490 public: |
460 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], | 491 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], |
461 const SkPaint& paint); | 492 const SkPaint& paint); |
462 virtual ~SkDrawPointsCommand() { delete [] fPts; } | 493 virtual ~SkDrawPointsCommand() { delete [] fPts; } |
463 void execute(SkCanvas* canvas) const override; | 494 void execute(SkCanvas* canvas) const override; |
464 bool render(SkCanvas* canvas) const override; | 495 bool render(SkCanvas* canvas) const override; |
465 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 496 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
466 static SkDrawPointsCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); | 497 static SkDrawPointsCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); |
467 | 498 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 void execute(SkCanvas* canvas) const override; | 770 void execute(SkCanvas* canvas) const override; |
740 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 771 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
741 static SkTranslateZCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); | 772 static SkTranslateZCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); |
742 | 773 |
743 private: | 774 private: |
744 SkScalar fZTranslate; | 775 SkScalar fZTranslate; |
745 | 776 |
746 typedef SkDrawCommand INHERITED; | 777 typedef SkDrawCommand INHERITED; |
747 }; | 778 }; |
748 #endif | 779 #endif |
OLD | NEW |