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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 kDrawRRect_OpType, | 47 kDrawRRect_OpType, |
48 kDrawText_OpType, | 48 kDrawText_OpType, |
49 kDrawTextBlob_OpType, | 49 kDrawTextBlob_OpType, |
50 kDrawTextOnPath_OpType, | 50 kDrawTextOnPath_OpType, |
51 kDrawVertices_OpType, | 51 kDrawVertices_OpType, |
52 kEndDrawPicture_OpType, | 52 kEndDrawPicture_OpType, |
53 kRestore_OpType, | 53 kRestore_OpType, |
54 kSave_OpType, | 54 kSave_OpType, |
55 kSaveLayer_OpType, | 55 kSaveLayer_OpType, |
56 kSetMatrix_OpType, | 56 kSetMatrix_OpType, |
| 57 kTranslateZ_OpType, |
57 | 58 |
58 kLast_OpType = kSetMatrix_OpType | 59 kLast_OpType = kTranslateZ_OpType |
59 }; | 60 }; |
60 | 61 |
61 static const int kOpTypeCount = kLast_OpType + 1; | 62 static const int kOpTypeCount = kLast_OpType + 1; |
62 | 63 |
63 static void WritePNG(const png_bytep rgba, png_uint_32 width, png_uint_32 he
ight, | 64 static void WritePNG(const png_bytep rgba, png_uint_32 width, png_uint_32 he
ight, |
64 SkWStream& out, bool isOpaque); | 65 SkWStream& out, bool isOpaque); |
65 | 66 |
66 SkDrawCommand(OpType opType); | 67 SkDrawCommand(OpType opType); |
67 | 68 |
68 virtual ~SkDrawCommand(); | 69 virtual ~SkDrawCommand(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 117 |
117 static const char* GetCommandString(OpType type); | 118 static const char* GetCommandString(OpType type); |
118 | 119 |
119 // Helper methods for converting things to JSON | 120 // Helper methods for converting things to JSON |
120 static Json::Value MakeJsonColor(const SkColor color); | 121 static Json::Value MakeJsonColor(const SkColor color); |
121 static Json::Value MakeJsonPoint(const SkPoint& point); | 122 static Json::Value MakeJsonPoint(const SkPoint& point); |
122 static Json::Value MakeJsonPoint(SkScalar x, SkScalar y); | 123 static Json::Value MakeJsonPoint(SkScalar x, SkScalar y); |
123 static Json::Value MakeJsonRect(const SkRect& rect); | 124 static Json::Value MakeJsonRect(const SkRect& rect); |
124 static Json::Value MakeJsonIRect(const SkIRect&); | 125 static Json::Value MakeJsonIRect(const SkIRect&); |
125 static Json::Value MakeJsonMatrix(const SkMatrix&); | 126 static Json::Value MakeJsonMatrix(const SkMatrix&); |
| 127 static Json::Value MakeJsonScalar(SkScalar); |
126 static Json::Value MakeJsonPath(const SkPath& path); | 128 static Json::Value MakeJsonPath(const SkPath& path); |
127 static Json::Value MakeJsonRegion(const SkRegion& region); | 129 static Json::Value MakeJsonRegion(const SkRegion& region); |
128 static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDa
taManager); | 130 static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDa
taManager); |
129 | 131 |
130 static void flatten(const SkFlattenable* flattenable, Json::Value* target, | 132 static void flatten(const SkFlattenable* flattenable, Json::Value* target, |
131 UrlDataManager& urlDataManager); | 133 UrlDataManager& urlDataManager); |
132 static bool flatten(const SkImage& image, Json::Value* target, | 134 static bool flatten(const SkImage& image, Json::Value* target, |
133 UrlDataManager& urlDataManager); | 135 UrlDataManager& urlDataManager); |
134 static bool flatten(const SkBitmap& bitmap, Json::Value* target, | 136 static bool flatten(const SkBitmap& bitmap, Json::Value* target, |
135 UrlDataManager& urlDataManager); | 137 UrlDataManager& urlDataManager); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 704 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
703 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); | 705 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); |
704 | 706 |
705 private: | 707 private: |
706 SkMatrix fUserMatrix; | 708 SkMatrix fUserMatrix; |
707 SkMatrix fMatrix; | 709 SkMatrix fMatrix; |
708 | 710 |
709 typedef SkDrawCommand INHERITED; | 711 typedef SkDrawCommand INHERITED; |
710 }; | 712 }; |
711 | 713 |
| 714 class SkTranslateZCommand : public SkDrawCommand { |
| 715 public: |
| 716 SkTranslateZCommand(SkScalar); |
| 717 void execute(SkCanvas* canvas) const override; |
| 718 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
| 719 static SkTranslateZCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); |
| 720 |
| 721 private: |
| 722 SkScalar fZTranslate; |
| 723 |
| 724 typedef SkDrawCommand INHERITED; |
| 725 }; |
712 #endif | 726 #endif |
OLD | NEW |