| 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, | |
| 28 kClipPath_OpType, | 27 kClipPath_OpType, |
| 29 kClipRegion_OpType, | 28 kClipRegion_OpType, |
| 30 kClipRect_OpType, | 29 kClipRect_OpType, |
| 31 kClipRRect_OpType, | 30 kClipRRect_OpType, |
| 32 kConcat_OpType, | 31 kConcat_OpType, |
| 33 kDrawAnnotation_OpType, | 32 kDrawAnnotation_OpType, |
| 34 kDrawBitmap_OpType, | 33 kDrawBitmap_OpType, |
| 35 kDrawBitmapNine_OpType, | 34 kDrawBitmapNine_OpType, |
| 36 kDrawBitmapRect_OpType, | 35 kDrawBitmapRect_OpType, |
| 37 kDrawClear_OpType, | 36 kDrawClear_OpType, |
| 38 kDrawDRRect_OpType, | 37 kDrawDRRect_OpType, |
| 39 kDrawImage_OpType, | 38 kDrawImage_OpType, |
| 40 kDrawImageRect_OpType, | 39 kDrawImageRect_OpType, |
| 41 kDrawOval_OpType, | 40 kDrawOval_OpType, |
| 42 kDrawPaint_OpType, | 41 kDrawPaint_OpType, |
| 43 kDrawPatch_OpType, | 42 kDrawPatch_OpType, |
| 44 kDrawPath_OpType, | 43 kDrawPath_OpType, |
| 45 kDrawPoints_OpType, | 44 kDrawPoints_OpType, |
| 46 kDrawPosText_OpType, | 45 kDrawPosText_OpType, |
| 47 kDrawPosTextH_OpType, | 46 kDrawPosTextH_OpType, |
| 48 kDrawRect_OpType, | 47 kDrawRect_OpType, |
| 49 kDrawRRect_OpType, | 48 kDrawRRect_OpType, |
| 50 kDrawText_OpType, | 49 kDrawText_OpType, |
| 51 kDrawTextBlob_OpType, | 50 kDrawTextBlob_OpType, |
| 52 kDrawTextOnPath_OpType, | 51 kDrawTextOnPath_OpType, |
| 53 kDrawTextRSXform_OpType, | 52 kDrawTextRSXform_OpType, |
| 54 kDrawVertices_OpType, | 53 kDrawVertices_OpType, |
| 55 kEndDrawPicture_OpType, | 54 kEndDrawPicture_OpType, |
| 56 kEndDrawShadowedPicture_OpType, | |
| 57 kRestore_OpType, | 55 kRestore_OpType, |
| 58 kSave_OpType, | 56 kSave_OpType, |
| 59 kSaveLayer_OpType, | 57 kSaveLayer_OpType, |
| 60 kSetMatrix_OpType, | 58 kSetMatrix_OpType, |
| 61 kTranslateZ_OpType, | 59 kTranslateZ_OpType, |
| 62 | 60 |
| 63 kLast_OpType = kTranslateZ_OpType | 61 kLast_OpType = kTranslateZ_OpType |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 static const int kOpTypeCount = kLast_OpType + 1; | 64 static const int kOpTypeCount = kLast_OpType + 1; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 SkEndDrawPictureCommand(bool restore); | 448 SkEndDrawPictureCommand(bool restore); |
| 451 | 449 |
| 452 void execute(SkCanvas* canvas) const override; | 450 void execute(SkCanvas* canvas) const override; |
| 453 | 451 |
| 454 private: | 452 private: |
| 455 bool fRestore; | 453 bool fRestore; |
| 456 | 454 |
| 457 typedef SkDrawCommand INHERITED; | 455 typedef SkDrawCommand INHERITED; |
| 458 }; | 456 }; |
| 459 | 457 |
| 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 | |
| 489 class SkDrawPointsCommand : public SkDrawCommand { | 458 class SkDrawPointsCommand : public SkDrawCommand { |
| 490 public: | 459 public: |
| 491 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], | 460 SkDrawPointsCommand(SkCanvas::PointMode mode, size_t count, const SkPoint pt
s[], |
| 492 const SkPaint& paint); | 461 const SkPaint& paint); |
| 493 virtual ~SkDrawPointsCommand() { delete [] fPts; } | 462 virtual ~SkDrawPointsCommand() { delete [] fPts; } |
| 494 void execute(SkCanvas* canvas) const override; | 463 void execute(SkCanvas* canvas) const override; |
| 495 bool render(SkCanvas* canvas) const override; | 464 bool render(SkCanvas* canvas) const override; |
| 496 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 465 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 497 static SkDrawPointsCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); | 466 static SkDrawPointsCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); |
| 498 | 467 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 void execute(SkCanvas* canvas) const override; | 739 void execute(SkCanvas* canvas) const override; |
| 771 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 740 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 772 static SkTranslateZCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); | 741 static SkTranslateZCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); |
| 773 | 742 |
| 774 private: | 743 private: |
| 775 SkScalar fZTranslate; | 744 SkScalar fZTranslate; |
| 776 | 745 |
| 777 typedef SkDrawCommand INHERITED; | 746 typedef SkDrawCommand INHERITED; |
| 778 }; | 747 }; |
| 779 #endif | 748 #endif |
| OLD | NEW |