| 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) {
|
|
|