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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 /* Converts a JSON representation of a command into a newly-allocated SkDraw
Command object. It | 110 /* Converts a JSON representation of a command into a newly-allocated SkDraw
Command object. It |
111 * is the caller's responsibility to delete this object. This method may ret
urn null if an error | 111 * is the caller's responsibility to delete this object. This method may ret
urn null if an error |
112 * occurs. | 112 * occurs. |
113 */ | 113 */ |
114 static SkDrawCommand* fromJSON(Json::Value& command, UrlDataManager& urlData
Manager); | 114 static SkDrawCommand* fromJSON(Json::Value& command, UrlDataManager& urlData
Manager); |
115 | 115 |
116 static const char* GetCommandString(OpType type); | 116 static const char* GetCommandString(OpType type); |
117 | 117 |
118 // Helper methods for converting things to JSON | 118 // Helper methods for converting things to JSON |
| 119 static Json::Value MakeJsonColor(const SkColor color); |
| 120 static Json::Value MakeJsonPoint(const SkPoint& point); |
| 121 static Json::Value MakeJsonPoint(SkScalar x, SkScalar y); |
| 122 static Json::Value MakeJsonRect(const SkRect& rect); |
119 static Json::Value MakeJsonIRect(const SkIRect&); | 123 static Json::Value MakeJsonIRect(const SkIRect&); |
120 static Json::Value MakeJsonMatrix(const SkMatrix&); | 124 static Json::Value MakeJsonMatrix(const SkMatrix&); |
| 125 static Json::Value MakeJsonPath(const SkPath& path); |
| 126 static Json::Value MakeJsonRegion(const SkRegion& region); |
| 127 static Json::Value MakeJsonPaint(const SkPaint& paint, UrlDataManager& urlDa
taManager); |
| 128 |
| 129 static void flatten(const SkFlattenable* flattenable, Json::Value* target, |
| 130 UrlDataManager& urlDataManager); |
| 131 static bool flatten(const SkImage& image, Json::Value* target, |
| 132 UrlDataManager& urlDataManager); |
| 133 static bool flatten(const SkBitmap& bitmap, Json::Value* target, |
| 134 UrlDataManager& urlDataManager); |
121 | 135 |
122 protected: | 136 protected: |
123 SkTDArray<SkString*> fInfo; | 137 SkTDArray<SkString*> fInfo; |
124 | 138 |
125 private: | 139 private: |
126 OpType fOpType; | 140 OpType fOpType; |
127 bool fVisible; | 141 bool fVisible; |
128 }; | 142 }; |
129 | 143 |
130 class SkRestoreCommand : public SkDrawCommand { | 144 class SkRestoreCommand : public SkDrawCommand { |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); | 687 static SkSetMatrixCommand* fromJSON(Json::Value& command, UrlDataManager& ur
lDataManager); |
674 | 688 |
675 private: | 689 private: |
676 SkMatrix fUserMatrix; | 690 SkMatrix fUserMatrix; |
677 SkMatrix fMatrix; | 691 SkMatrix fMatrix; |
678 | 692 |
679 typedef SkDrawCommand INHERITED; | 693 typedef SkDrawCommand INHERITED; |
680 }; | 694 }; |
681 | 695 |
682 #endif | 696 #endif |
OLD | NEW |