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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 kDrawText_OpType, | 49 kDrawText_OpType, |
50 kDrawTextBlob_OpType, | 50 kDrawTextBlob_OpType, |
51 kDrawTextOnPath_OpType, | 51 kDrawTextOnPath_OpType, |
52 kDrawTextRSXform_OpType, | 52 kDrawTextRSXform_OpType, |
53 kDrawVertices_OpType, | 53 kDrawVertices_OpType, |
54 kEndDrawPicture_OpType, | 54 kEndDrawPicture_OpType, |
55 kRestore_OpType, | 55 kRestore_OpType, |
56 kSave_OpType, | 56 kSave_OpType, |
57 kSaveLayer_OpType, | 57 kSaveLayer_OpType, |
58 kSetMatrix_OpType, | 58 kSetMatrix_OpType, |
59 kTranslateZ_OpType, | |
60 | 59 |
61 kLast_OpType = kTranslateZ_OpType | 60 kLast_OpType = kSetMatrix_OpType |
62 }; | 61 }; |
63 | 62 |
64 static const int kOpTypeCount = kLast_OpType + 1; | 63 static const int kOpTypeCount = kLast_OpType + 1; |
65 | 64 |
66 static void WritePNG(const png_bytep rgba, png_uint_32 width, png_uint_32 he
ight, | 65 static void WritePNG(const png_bytep rgba, png_uint_32 width, png_uint_32 he
ight, |
67 SkWStream& out, bool isOpaque); | 66 SkWStream& out, bool isOpaque); |
68 | 67 |
69 SkDrawCommand(OpType opType); | 68 SkDrawCommand(OpType opType); |
70 | 69 |
71 virtual ~SkDrawCommand(); | 70 virtual ~SkDrawCommand(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 118 |
120 static const char* GetCommandString(OpType type); | 119 static const char* GetCommandString(OpType type); |
121 | 120 |
122 // Helper methods for converting things to JSON | 121 // Helper methods for converting things to JSON |
123 static Json::Value MakeJsonColor(const SkColor color); | 122 static Json::Value MakeJsonColor(const SkColor color); |
124 static Json::Value MakeJsonPoint(const SkPoint& point); | 123 static Json::Value MakeJsonPoint(const SkPoint& point); |
125 static Json::Value MakeJsonPoint(SkScalar x, SkScalar y); | 124 static Json::Value MakeJsonPoint(SkScalar x, SkScalar y); |
126 static Json::Value MakeJsonRect(const SkRect& rect); | 125 static Json::Value MakeJsonRect(const SkRect& rect); |
127 static Json::Value MakeJsonIRect(const SkIRect&); | 126 static Json::Value MakeJsonIRect(const SkIRect&); |
128 static Json::Value MakeJsonMatrix(const SkMatrix&); | 127 static Json::Value MakeJsonMatrix(const SkMatrix&); |
129 static Json::Value MakeJsonScalar(SkScalar); | |
130 static Json::Value MakeJsonPath(const SkPath& path); | 128 static Json::Value MakeJsonPath(const SkPath& path); |
131 static Json::Value MakeJsonRegion(const SkRegion& region); | 129 static Json::Value MakeJsonRegion(const SkRegion& region); |
132 static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDa
taManager); | 130 static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDa
taManager); |
133 | 131 |
134 static void flatten(const SkFlattenable* flattenable, Json::Value* target, | 132 static void flatten(const SkFlattenable* flattenable, Json::Value* target, |
135 UrlDataManager& urlDataManager); | 133 UrlDataManager& urlDataManager); |
136 static bool flatten(const SkImage& image, Json::Value* target, | 134 static bool flatten(const SkImage& image, Json::Value* target, |
137 UrlDataManager& urlDataManager); | 135 UrlDataManager& urlDataManager); |
138 static bool flatten(const SkBitmap& bitmap, Json::Value* target, | 136 static bool flatten(const SkBitmap& bitmap, Json::Value* target, |
139 UrlDataManager& urlDataManager); | 137 UrlDataManager& urlDataManager); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | 724 Json::Value toJSON(UrlDataManager& urlDataManager) const override; |
727 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); | 725 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); |
728 | 726 |
729 private: | 727 private: |
730 SkMatrix fUserMatrix; | 728 SkMatrix fUserMatrix; |
731 SkMatrix fMatrix; | 729 SkMatrix fMatrix; |
732 | 730 |
733 typedef SkDrawCommand INHERITED; | 731 typedef SkDrawCommand INHERITED; |
734 }; | 732 }; |
735 | 733 |
736 class SkTranslateZCommand : public SkDrawCommand { | |
737 public: | |
738 SkTranslateZCommand(SkScalar); | |
739 void execute(SkCanvas* canvas) const override; | |
740 Json::Value toJSON(UrlDataManager& urlDataManager) const override; | |
741 static SkTranslateZCommand* fromJSON(Json::Value& command, UrlDataManager& u
rlDataManager); | |
742 | |
743 private: | |
744 SkScalar fZTranslate; | |
745 | |
746 typedef SkDrawCommand INHERITED; | |
747 }; | |
748 #endif | 734 #endif |
OLD | NEW |