Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: tools/json/SkJSONCanvas.h

Issue 1662503003: support for more features when rendering to/from JSON (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/json.gyp ('k') | tools/json/SkJSONCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json/SkJSONCanvas.h
diff --git a/tools/json/SkJSONCanvas.h b/tools/json/SkJSONCanvas.h
index 27cb398a3652554d9fdb8bc41162f98eae314f5e..76d1be0ac5ff83aab6eda33fe8963cee39a0fea5 100644
--- a/tools/json/SkJSONCanvas.h
+++ b/tools/json/SkJSONCanvas.h
@@ -45,9 +45,11 @@
#define SKJSONCANVAS_COMMAND_CLIPREGION "ClipRegion"
#define SKJSONCANVAS_COMMAND_SAVE "Save"
#define SKJSONCANVAS_COMMAND_RESTORE "Restore"
+#define SKJSONCANVAS_COMMAND_SAVELAYER "SaveLayer"
#define SKJSONCANVAS_ATTRIBUTE_MATRIX "matrix"
#define SKJSONCANVAS_ATTRIBUTE_COORDS "coords"
+#define SKJSONCANVAS_ATTRIBUTE_BOUNDS "bounds"
#define SKJSONCANVAS_ATTRIBUTE_PAINT "paint"
#define SKJSONCANVAS_ATTRIBUTE_OUTER "outer"
#define SKJSONCANVAS_ATTRIBUTE_INNER "inner"
@@ -58,6 +60,8 @@
#define SKJSONCANVAS_ATTRIBUTE_COLOR "color"
#define SKJSONCANVAS_ATTRIBUTE_STYLE "style"
#define SKJSONCANVAS_ATTRIBUTE_STROKEWIDTH "strokeWidth"
+#define SKJSONCANVAS_ATTRIBUTE_STROKEMITER "strokeMiter"
+#define SKJSONCANVAS_ATTRIBUTE_CAP "cap"
#define SKJSONCANVAS_ATTRIBUTE_ANTIALIAS "antiAlias"
#define SKJSONCANVAS_ATTRIBUTE_REGION "region"
#define SKJSONCANVAS_ATTRIBUTE_REGIONOP "op"
@@ -75,6 +79,19 @@
#define SKJSONCANVAS_ATTRIBUTE_PHASE "phase"
#define SKJSONCANVAS_ATTRIBUTE_FILLTYPE "fillType"
#define SKJSONCANVAS_ATTRIBUTE_VERBS "verbs"
+#define SKJSONCANVAS_ATTRIBUTE_NAME "name"
+#define SKJSONCANVAS_ATTRIBUTE_BYTES "bytes"
+#define SKJSONCANVAS_ATTRIBUTE_SHADER "shader"
+#define SKJSONCANVAS_ATTRIBUTE_PATHEFFECT "pathEffect"
+#define SKJSONCANVAS_ATTRIBUTE_MASKFILTER "maskFilter"
+#define SKJSONCANVAS_ATTRIBUTE_XFERMODE "xfermode"
+#define SKJSONCANVAS_ATTRIBUTE_BACKDROP "backdrop"
+#define SKJSONCANVAS_ATTRIBUTE_IMAGE "image"
+#define SKJSONCANVAS_ATTRIBUTE_BITMAP "bitmap"
+#define SKJSONCANVAS_ATTRIBUTE_SRC "src"
+#define SKJSONCANVAS_ATTRIBUTE_DST "dst"
+#define SKJSONCANVAS_ATTRIBUTE_STRICT "strict"
+#define SKJSONCANVAS_ATTRIBUTE_DESCRIPTION "description"
#define SKJSONCANVAS_VERB_MOVE "move"
#define SKJSONCANVAS_VERB_LINE "line"
@@ -115,6 +132,10 @@
#define SKJSONCANVAS_FILLTYPE_INVERSEWINDING "inverseWinding"
#define SKJSONCANVAS_FILLTYPE_INVERSEEVENODD "inverseEvenOdd"
+#define SKJSONCANVAS_CAP_BUTT "butt"
+#define SKJSONCANVAS_CAP_ROUND "round"
+#define SKJSONCANVAS_CAP_SQUARE "square"
+
/*
* Implementation of SkCanvas which writes JSON when drawn to. The JSON describes all of the draw
* commands issued to the canvas, and can later be turned back into draw commands using
@@ -123,7 +144,7 @@
class SkJSONCanvas : public SkCanvas {
public:
/* Create a canvas which writes to the specified output stream. */
- SkJSONCanvas(int width, int height, SkWStream& out);
+ SkJSONCanvas(int width, int height, SkWStream& out, bool sendBinaries = false);
/* Complete the JSON document. */
void finish();
@@ -202,6 +223,8 @@ public:
void willRestore() override;
+ SkCanvas::SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override;
+
private:
Json::Value makePoint(const SkPoint& point);
@@ -231,6 +254,7 @@ private:
SkMatrix fLastMatrix;
Json::Value fRoot;
Json::Value fCommands;
+ bool fSendBinaries;
typedef SkCanvas INHERITED;
};
« no previous file with comments | « gyp/json.gyp ('k') | tools/json/SkJSONCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698