aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'tools/debugger')
-rw-r--r--tools/debugger/SkDebugCanvas.cpp4
-rw-r--r--tools/debugger/SkDebugCanvas.h7
2 files changed, 6 insertions, 5 deletions
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index d8d51fe0ac..8b71c0fb2c 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -318,11 +318,11 @@ SkTDArray <SkDrawCommand*>& SkDebugCanvas::getDrawCommands() {
return fCommandVector;
}
-Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager) {
+Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n) {
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++) {
+ for (int i = 0; i < this->getSize() && i < n; i++) {
commands[i] = this->getDrawCommandAt(i)->toJSON();
}
result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands;
diff --git a/tools/debugger/SkDebugCanvas.h b/tools/debugger/SkDebugCanvas.h
index 505b5c79fa..339e7add4a 100644
--- a/tools/debugger/SkDebugCanvas.h
+++ b/tools/debugger/SkDebugCanvas.h
@@ -141,10 +141,11 @@ public:
SkString clipStackData() const { return fClipStackData; }
/**
- Returns a JSON object representing all of the draws. The encoder may use the UrlDataManager
- to store binary data such as images, referring to them via URLs embedded in the JSON.
+ Returns a JSON object representing up to N draws, where N is < SkDebugCanvas::getSize().
+ The encoder may use the UrlDataManager to store binary data such as images, referring to
+ them via URLs embedded in the JSON.
*/
- Json::Value toJSON(UrlDataManager& urlDataManager);
+ Json::Value toJSON(UrlDataManager& urlDataManager, int n);
////////////////////////////////////////////////////////////////////////////////
// Inherited from SkCanvas