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

Unified Diff: tools/debugger/SkDrawCommand.cpp

Issue 1705093002: Add batch information to json (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix cpu bot Created 4 years, 10 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 | « tools/debugger/SkDrawCommand.h ('k') | tools/skiaserve/skiaserve.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/debugger/SkDrawCommand.cpp
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index f23c41a0e90d2bbccf3c7600049e00ad19565306..674a359cbbc4e0d21ae5ae7c3625f0c2fc0750a3 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -8,6 +8,7 @@
#include "SkDrawCommand.h"
+
#include "SkBlurMaskFilter.h"
#include "SkColorFilter.h"
#include "SkDashPathEffect.h"
@@ -24,7 +25,13 @@
#include "SkValidatingReadBuffer.h"
#include "SkWriteBuffer.h"
+#if SK_SUPPORT_GPU
+#include "GrContext.h"
+#include "GrRenderTarget.h"
+#endif
+
#define SKDEBUGCANVAS_ATTRIBUTE_COMMAND "command"
+#define SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL "auditTrail"
#define SKDEBUGCANVAS_ATTRIBUTE_MATRIX "matrix"
#define SKDEBUGCANVAS_ATTRIBUTE_COORDS "coords"
#define SKDEBUGCANVAS_ATTRIBUTE_BOUNDS "bounds"
@@ -218,6 +225,37 @@ Json::Value SkDrawCommand::toJSON(UrlDataManager& urlDataManager) const {
return result;
}
+Json::Value SkDrawCommand::drawToAndCollectJSON(SkCanvas* canvas,
+ UrlDataManager& urlDataManager) const {
+ Json::Value result;
+ result[SKDEBUGCANVAS_ATTRIBUTE_COMMAND] = this->GetCommandString(fOpType);
+
+ SkASSERT(canvas);
+
+#if SK_SUPPORT_GPU
+ GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
+ if (rt) {
+ GrContext* ctx = rt->getContext();
+ if(ctx) {
+ this->execute(canvas);
+ GrAuditTrail* at = ctx->getAuditTrail();
+
+ // TODO if this is inefficient we could add a method to GrAuditTrail which takes
+ // a Json::Value and is only compiled in this file
+ Json::Value parsedFromString;
+ Json::Reader reader;
+ SkDEBUGCODE(bool parsingSuccessful = )reader.parse(at->toJson().c_str(),
+ parsedFromString);
+ SkASSERT(parsingSuccessful);
+
+ result[SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL] = parsedFromString;
+ at->reset();
+ }
+ }
+#endif
+ return result;
+}
+
#define INSTALL_FACTORY(name) factories.set(SkString(GetCommandString(k ## name ##_OpType)), \
(FROM_JSON) Sk ## name ## Command::fromJSON)
SkDrawCommand* SkDrawCommand::fromJSON(Json::Value& command, UrlDataManager& urlDataManager) {
« no previous file with comments | « tools/debugger/SkDrawCommand.h ('k') | tools/skiaserve/skiaserve.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698