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 "SkString.h" | 18 #include "SkString.h" |
18 #include "SkTDArray.h" | 19 #include "SkTDArray.h" |
19 #include "SkJSONCPP.h" | 20 #include "SkJSONCPP.h" |
20 #include "UrlDataManager.h" | 21 #include "UrlDataManager.h" |
21 | 22 |
22 class SK_API SkDrawCommand { | 23 class SK_API SkDrawCommand { |
23 public: | 24 public: |
24 enum OpType { | 25 enum OpType { |
25 kBeginDrawPicture_OpType, | 26 kBeginDrawPicture_OpType, |
26 kClipPath_OpType, | 27 kClipPath_OpType, |
(...skipping 14 matching lines...) Expand all Loading... |
41 kDrawPatch_OpType, | 42 kDrawPatch_OpType, |
42 kDrawPath_OpType, | 43 kDrawPath_OpType, |
43 kDrawPoints_OpType, | 44 kDrawPoints_OpType, |
44 kDrawPosText_OpType, | 45 kDrawPosText_OpType, |
45 kDrawPosTextH_OpType, | 46 kDrawPosTextH_OpType, |
46 kDrawRect_OpType, | 47 kDrawRect_OpType, |
47 kDrawRRect_OpType, | 48 kDrawRRect_OpType, |
48 kDrawText_OpType, | 49 kDrawText_OpType, |
49 kDrawTextBlob_OpType, | 50 kDrawTextBlob_OpType, |
50 kDrawTextOnPath_OpType, | 51 kDrawTextOnPath_OpType, |
| 52 kDrawTextRSXform_OpType, |
51 kDrawVertices_OpType, | 53 kDrawVertices_OpType, |
52 kEndDrawPicture_OpType, | 54 kEndDrawPicture_OpType, |
53 kRestore_OpType, | 55 kRestore_OpType, |
54 kSave_OpType, | 56 kSave_OpType, |
55 kSaveLayer_OpType, | 57 kSaveLayer_OpType, |
56 kSetMatrix_OpType, | 58 kSetMatrix_OpType, |
57 | 59 |
58 kLast_OpType = kSetMatrix_OpType | 60 kLast_OpType = kSetMatrix_OpType |
59 }; | 61 }; |
60 | 62 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 private: | 521 private: |
520 char* fText; | 522 char* fText; |
521 size_t fByteLength; | 523 size_t fByteLength; |
522 SkPath fPath; | 524 SkPath fPath; |
523 SkMatrix fMatrix; | 525 SkMatrix fMatrix; |
524 SkPaint fPaint; | 526 SkPaint fPaint; |
525 | 527 |
526 typedef SkDrawCommand INHERITED; | 528 typedef SkDrawCommand INHERITED; |
527 }; | 529 }; |
528 | 530 |
| 531 class SkDrawTextRSXformCommand : public SkDrawCommand { |
| 532 public: |
| 533 SkDrawTextRSXformCommand(const void* text, size_t byteLength, const SkRSXfor
m[], |
| 534 const SkRect*, const SkPaint& paint); |
| 535 ~SkDrawTextRSXformCommand() override { delete[] fText; delete[] fXform; } |
| 536 void execute(SkCanvas* canvas) const override; |
| 537 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 538 static SkDrawTextRSXformCommand* fromJSON(Json::Value& command, UrlDataManag
er& urlDataManager); |
| 539 |
| 540 private: |
| 541 char* fText; |
| 542 size_t fByteLength; |
| 543 SkRSXform* fXform; |
| 544 SkRect* fCull; |
| 545 SkRect fCullStorage; |
| 546 SkPaint fPaint; |
| 547 |
| 548 typedef SkDrawCommand INHERITED; |
| 549 }; |
| 550 |
529 class SkDrawPosTextHCommand : public SkDrawCommand { | 551 class SkDrawPosTextHCommand : public SkDrawCommand { |
530 public: | 552 public: |
531 SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xp
os[], | 553 SkDrawPosTextHCommand(const void* text, size_t byteLength, const SkScalar xp
os[], |
532 SkScalar constY, const SkPaint& paint); | 554 SkScalar constY, const SkPaint& paint); |
533 virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } | 555 virtual ~SkDrawPosTextHCommand() { delete [] fXpos; delete [] fText; } |
534 void execute(SkCanvas* canvas) const override; | 556 void execute(SkCanvas* canvas) const override; |
535 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 557 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
536 static SkDrawPosTextHCommand* fromJSON(Json::Value& command, UrlDataManager&
urlDataManager); | 558 static SkDrawPosTextHCommand* fromJSON(Json::Value& command, UrlDataManager&
urlDataManager); |
537 | 559 |
538 private: | 560 private: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); | 725 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); |
704 | 726 |
705 private: | 727 private: |
706 SkMatrix fUserMatrix; | 728 SkMatrix fUserMatrix; |
707 SkMatrix fMatrix; | 729 SkMatrix fMatrix; |
708 | 730 |
709 typedef SkDrawCommand INHERITED; | 731 typedef SkDrawCommand INHERITED; |
710 }; | 732 }; |
711 | 733 |
712 #endif | 734 #endif |
OLD | NEW |