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