Index: tools/debugger/SkDebugCanvas.cpp |
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp |
index c2dd8f8a1915376cffcd47e6ccd64d935a14dc27..d8d51fe0ace3b260bf360d27bd62f49cd9af0fb1 100644 |
--- a/tools/debugger/SkDebugCanvas.cpp |
+++ b/tools/debugger/SkDebugCanvas.cpp |
@@ -12,6 +12,10 @@ |
#include "SkPaintFilterCanvas.h" |
#include "SkOverdrawMode.h" |
+#define SKDEBUGCANVAS_VERSION 1 |
+#define SKDEBUGCANVAS_ATTRIBUTE_VERSION "version" |
+#define SKDEBUGCANVAS_ATTRIBUTE_COMMANDS "commands" |
+ |
class DebugPaintFilterCanvas : public SkPaintFilterCanvas { |
public: |
DebugPaintFilterCanvas(int width, |
@@ -314,6 +318,17 @@ SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() { |
return fCommandVector; |
} |
+Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager) { |
+ Json::Value result = Json::Value(Json::objectValue); |
+ result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION); |
+ Json::Value commands = Json::Value(Json::arrayValue); |
+ for (int i = 0; i < this->getSize(); i++) { |
+ commands[i] = this->getDrawCommandAt(i)->toJSON(); |
+ } |
+ result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands; |
+ return result; |
+} |
+ |
void SkDebugCanvas::updatePaintFilterCanvas() { |
if (!fOverdrawViz && !fOverrideFilterQuality) { |
fPaintFilterCanvas.reset(nullptr); |