| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 SkJSONCanvas_DEFINED | 8 #ifndef SkJSONCanvas_DEFINED |
| 9 #define SkJSONCanvas_DEFINED | 9 #define SkJSONCanvas_DEFINED |
| 10 | 10 |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkStream.h" | 12 #include "SkStream.h" |
| 13 #include "SkJSONCPP.h" | 13 #include "SkJSONCPP.h" |
| 14 | 14 |
| 15 #define SKJSONCANVAS_VERSION "version" | 15 #define SKJSONCANVAS_VERSION "version" |
| 16 #define SKJSONCANVAS_COMMANDS "commands" | 16 #define SKJSONCANVAS_COMMANDS "commands" |
| 17 #define SKJSONCANVAS_COMMAND "command" | 17 #define SKJSONCANVAS_COMMAND "command" |
| 18 | 18 |
| 19 #define SKJSONCANVAS_COMMAND_TRANSLATE "Translate" |
| 20 #define SKJSONCANVAS_COMMAND_SCALE "Scale" |
| 19 #define SKJSONCANVAS_COMMAND_MATRIX "Matrix" | 21 #define SKJSONCANVAS_COMMAND_MATRIX "Matrix" |
| 20 #define SKJSONCANVAS_COMMAND_PAINT "Paint" | 22 #define SKJSONCANVAS_COMMAND_PAINT "Paint" |
| 21 #define SKJSONCANVAS_COMMAND_RECT "Rect" | 23 #define SKJSONCANVAS_COMMAND_RECT "Rect" |
| 22 #define SKJSONCANVAS_COMMAND_OVAL "Oval" | 24 #define SKJSONCANVAS_COMMAND_OVAL "Oval" |
| 23 #define SKJSONCANVAS_COMMAND_RRECT "RRect" | 25 #define SKJSONCANVAS_COMMAND_RRECT "RRect" |
| 24 #define SKJSONCANVAS_COMMAND_DRRECT "DRRect" | 26 #define SKJSONCANVAS_COMMAND_DRRECT "DRRect" |
| 25 #define SKJSONCANVAS_COMMAND_POINTS "Points" | 27 #define SKJSONCANVAS_COMMAND_POINTS "Points" |
| 26 #define SKJSONCANVAS_COMMAND_VERTICES "Vertices" | 28 #define SKJSONCANVAS_COMMAND_VERTICES "Vertices" |
| 27 #define SKJSONCANVAS_COMMAND_ATLAS "Atlas" | 29 #define SKJSONCANVAS_COMMAND_ATLAS "Atlas" |
| 28 #define SKJSONCANVAS_COMMAND_PATH "Path" | 30 #define SKJSONCANVAS_COMMAND_PATH "Path" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 #define SKJSONCANVAS_ATTRIBUTE_MASKFILTER "maskFilter" | 89 #define SKJSONCANVAS_ATTRIBUTE_MASKFILTER "maskFilter" |
| 88 #define SKJSONCANVAS_ATTRIBUTE_XFERMODE "xfermode" | 90 #define SKJSONCANVAS_ATTRIBUTE_XFERMODE "xfermode" |
| 89 #define SKJSONCANVAS_ATTRIBUTE_BACKDROP "backdrop" | 91 #define SKJSONCANVAS_ATTRIBUTE_BACKDROP "backdrop" |
| 90 #define SKJSONCANVAS_ATTRIBUTE_IMAGEFILTER "imagefilter" | 92 #define SKJSONCANVAS_ATTRIBUTE_IMAGEFILTER "imagefilter" |
| 91 #define SKJSONCANVAS_ATTRIBUTE_IMAGE "image" | 93 #define SKJSONCANVAS_ATTRIBUTE_IMAGE "image" |
| 92 #define SKJSONCANVAS_ATTRIBUTE_BITMAP "bitmap" | 94 #define SKJSONCANVAS_ATTRIBUTE_BITMAP "bitmap" |
| 93 #define SKJSONCANVAS_ATTRIBUTE_SRC "src" | 95 #define SKJSONCANVAS_ATTRIBUTE_SRC "src" |
| 94 #define SKJSONCANVAS_ATTRIBUTE_DST "dst" | 96 #define SKJSONCANVAS_ATTRIBUTE_DST "dst" |
| 95 #define SKJSONCANVAS_ATTRIBUTE_STRICT "strict" | 97 #define SKJSONCANVAS_ATTRIBUTE_STRICT "strict" |
| 96 #define SKJSONCANVAS_ATTRIBUTE_DESCRIPTION "description" | 98 #define SKJSONCANVAS_ATTRIBUTE_DESCRIPTION "description" |
| 99 #define SKJSONCANVAS_ATTRIBUTE_X "x" |
| 100 #define SKJSONCANVAS_ATTRIBUTE_Y "y" |
| 97 | 101 |
| 98 #define SKJSONCANVAS_VERB_MOVE "move" | 102 #define SKJSONCANVAS_VERB_MOVE "move" |
| 99 #define SKJSONCANVAS_VERB_LINE "line" | 103 #define SKJSONCANVAS_VERB_LINE "line" |
| 100 #define SKJSONCANVAS_VERB_QUAD "quad" | 104 #define SKJSONCANVAS_VERB_QUAD "quad" |
| 101 #define SKJSONCANVAS_VERB_CUBIC "cubic" | 105 #define SKJSONCANVAS_VERB_CUBIC "cubic" |
| 102 #define SKJSONCANVAS_VERB_CONIC "conic" | 106 #define SKJSONCANVAS_VERB_CONIC "conic" |
| 103 #define SKJSONCANVAS_VERB_CLOSE "close" | 107 #define SKJSONCANVAS_VERB_CLOSE "close" |
| 104 | 108 |
| 105 #define SKJSONCANVAS_STYLE_FILL "fill" | 109 #define SKJSONCANVAS_STYLE_FILL "fill" |
| 106 #define SKJSONCANVAS_STYLE_STROKE "stroke" | 110 #define SKJSONCANVAS_STYLE_STROKE "stroke" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 166 |
| 163 /* Complete the JSON document. */ | 167 /* Complete the JSON document. */ |
| 164 void finish(); | 168 void finish(); |
| 165 | 169 |
| 166 static Json::Value MakeMatrix(const SkMatrix& matrix); | 170 static Json::Value MakeMatrix(const SkMatrix& matrix); |
| 167 | 171 |
| 168 static Json::Value MakeIRect(const SkIRect& irect); | 172 static Json::Value MakeIRect(const SkIRect& irect); |
| 169 | 173 |
| 170 // overridden SkCanvas API | 174 // overridden SkCanvas API |
| 171 | 175 |
| 176 void didConcat(const SkMatrix&) override; |
| 177 |
| 178 void didSetMatrix(const SkMatrix&) override; |
| 179 |
| 172 void onDrawPaint(const SkPaint&) override; | 180 void onDrawPaint(const SkPaint&) override; |
| 173 | 181 |
| 174 void onDrawRect(const SkRect&, const SkPaint&) override; | 182 void onDrawRect(const SkRect&, const SkPaint&) override; |
| 175 | 183 |
| 176 void onDrawOval(const SkRect&, const SkPaint&) override; | 184 void onDrawOval(const SkRect&, const SkPaint&) override; |
| 177 | 185 |
| 178 void onDrawRRect(const SkRRect&, const SkPaint&) override; | 186 void onDrawRRect(const SkRRect&, const SkPaint&) override; |
| 179 | 187 |
| 180 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; | 188 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; |
| 181 | 189 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 269 |
| 262 Json::Value makeRegionOp(SkRegion::Op op); | 270 Json::Value makeRegionOp(SkRegion::Op op); |
| 263 | 271 |
| 264 Json::Value makeEdgeStyle(SkCanvas::ClipEdgeStyle edgeStyle); | 272 Json::Value makeEdgeStyle(SkCanvas::ClipEdgeStyle edgeStyle); |
| 265 | 273 |
| 266 Json::Value makePointMode(SkCanvas::PointMode mode); | 274 Json::Value makePointMode(SkCanvas::PointMode mode); |
| 267 | 275 |
| 268 void updateMatrix(); | 276 void updateMatrix(); |
| 269 | 277 |
| 270 SkWStream& fOut; | 278 SkWStream& fOut; |
| 271 SkMatrix fLastMatrix; | |
| 272 Json::Value fRoot; | 279 Json::Value fRoot; |
| 273 Json::Value fCommands; | 280 Json::Value fCommands; |
| 274 bool fSendBinaries; | 281 bool fSendBinaries; |
| 275 | 282 |
| 276 typedef SkCanvas INHERITED; | 283 typedef SkCanvas INHERITED; |
| 277 }; | 284 }; |
| 278 | 285 |
| 279 #endif | 286 #endif |
| OLD | NEW |