Make GrAuditTrail V1-only
This CL has some rough edges since some classes that use it (e.g., GrOpsTask) aren't yet V1-only. That said, the big CL has to be broken up somehow. Bug: skia:11837 Change-Id: I41ed9982ca4664f893e447ba23c7aec59f42c964 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426416 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
2d25d28e51
commit
a92913e169
@ -38,7 +38,6 @@ skia_gpu_sources = [
|
||||
"$_src/gpu/GrAppliedClip.h",
|
||||
"$_src/gpu/GrAttachment.cpp",
|
||||
"$_src/gpu/GrAttachment.h",
|
||||
"$_src/gpu/GrAuditTrail.cpp",
|
||||
"$_src/gpu/GrAuditTrail.h",
|
||||
"$_src/gpu/GrAutoLocaleSetter.h",
|
||||
"$_src/gpu/GrBackendSemaphore.cpp",
|
||||
@ -556,6 +555,7 @@ skia_skgpu_v2_sources = [
|
||||
]
|
||||
|
||||
skia_skgpu_v1_sources = [
|
||||
"$_src/gpu/GrAuditTrail.cpp",
|
||||
"$_src/gpu/GrClipStack.cpp",
|
||||
"$_src/gpu/GrClipStack.h",
|
||||
"$_src/gpu/GrClipStackClip.cpp",
|
||||
|
@ -197,8 +197,6 @@ protected:
|
||||
*/
|
||||
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
|
||||
|
||||
GrAuditTrail* auditTrail() { return fAuditTrail.get(); }
|
||||
|
||||
GrRecordingContext* asRecordingContext() override { return this; }
|
||||
|
||||
class Stats {
|
||||
@ -251,10 +249,11 @@ protected:
|
||||
const Stats* stats() const { return &fStats; }
|
||||
void dumpJSON(SkJSONWriter*) const;
|
||||
|
||||
private:
|
||||
protected:
|
||||
// Delete last in case other objects call it during destruction.
|
||||
std::unique_ptr<GrAuditTrail> fAuditTrail;
|
||||
|
||||
private:
|
||||
OwnedArenas fArenas;
|
||||
|
||||
std::unique_ptr<GrDrawingManager> fDrawingManager;
|
||||
|
@ -8,6 +8,10 @@
|
||||
#ifndef GrAuditTrail_DEFINED
|
||||
#define GrAuditTrail_DEFINED
|
||||
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
||||
#if SK_GPU_V1
|
||||
|
||||
#include "include/core/SkRect.h"
|
||||
#include "include/core/SkString.h"
|
||||
#include "include/gpu/GrConfig.h"
|
||||
@ -172,4 +176,14 @@ private:
|
||||
#define GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(audit_trail, combineWith, op) \
|
||||
GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, opsCombined, combineWith, op)
|
||||
|
||||
#endif
|
||||
#else // SK_GPU_V1
|
||||
|
||||
class GrAuditTrail {
|
||||
};
|
||||
|
||||
#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename)
|
||||
#define GR_AUDIT_TRAIL_ADD_OP(audit_trail, op, proxy_id)
|
||||
#define GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(audit_trail, combineWith, op)
|
||||
|
||||
#endif // SK_GPU_V1
|
||||
#endif // GrAuditTrail_DEFINED
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "include/gpu/GrContextThreadSafeProxy.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkRuntimeEffectPriv.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
|
||||
#include "src/gpu/GrDrawingManager.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
*/
|
||||
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
|
||||
|
||||
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
|
||||
GrAuditTrail* auditTrail() { return fContext->fAuditTrail.get(); }
|
||||
|
||||
/**
|
||||
* Finalizes all pending reads and writes to the surfaces and also performs an MSAA resolves
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
#include "src/core/SkDeferredDisplayListPriv.h"
|
||||
#include "src/core/SkTInternalLList.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrClientMappedBufferManager.h"
|
||||
#include "src/gpu/GrCopyRenderTask.h"
|
||||
#include "src/gpu/GrDDLTask.h"
|
||||
@ -703,6 +702,7 @@ sk_sp<GrOpsTask> GrDrawingManager::newOpsTask(GrSurfaceProxyView surfaceView,
|
||||
std::move(surfaceView),
|
||||
fContext->priv().auditTrail(),
|
||||
std::move(arenas)));
|
||||
|
||||
SkASSERT(this->getLastRenderTask(opsTask->target(0)) == opsTask.get());
|
||||
|
||||
if (flushTimeOpsTask) {
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/core/SkMipmap.h"
|
||||
#include "src/gpu/GrAttachment.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrBackendUtils.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
*/
|
||||
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
|
||||
|
||||
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
|
||||
GrAuditTrail* auditTrail() { return fContext->fAuditTrail.get(); }
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
// Used by tests that intentionally exercise codepaths that print warning messages, in order to
|
||||
|
@ -225,8 +225,9 @@ private:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// return true on success; false on failure
|
||||
bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrSoftwarePathRenderer::onDrawPath");
|
||||
|
||||
if (!fProxyProvider) {
|
||||
return false;
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "src/core/SkAutoPixmapStorage.h"
|
||||
#include "src/core/SkMipmap.h"
|
||||
#include "src/core/SkYUVMath.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrClientMappedBufferManager.h"
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
@ -147,10 +146,6 @@ GrSurfaceContext::GrSurfaceContext(GrRecordingContext* context,
|
||||
|
||||
const GrCaps* GrSurfaceContext::caps() const { return fContext->priv().caps(); }
|
||||
|
||||
GrAuditTrail* GrSurfaceContext::auditTrail() {
|
||||
return fContext->priv().auditTrail();
|
||||
}
|
||||
|
||||
GrDrawingManager* GrSurfaceContext::drawingManager() {
|
||||
return fContext->priv().drawingManager();
|
||||
}
|
||||
@ -172,7 +167,8 @@ bool GrSurfaceContext::readPixels(GrDirectContext* dContext, GrPixmap dst, SkIPo
|
||||
ASSERT_SINGLE_OWNER
|
||||
RETURN_FALSE_IF_ABANDONED
|
||||
SkDEBUGCODE(this->validate();)
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::readPixels");
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "readPixels", fContext);
|
||||
|
||||
if (!fContext->priv().matches(dContext)) {
|
||||
return false;
|
||||
}
|
||||
@ -421,7 +417,7 @@ bool GrSurfaceContext::internalWritePixels(GrDirectContext* dContext,
|
||||
const GrCPixmap src[],
|
||||
int numLevels,
|
||||
SkIPoint pt) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContext::internalWritePixels");
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "internalWritePixels", fContext);
|
||||
|
||||
SkASSERT(numLevels >= 1);
|
||||
SkASSERT(src);
|
||||
@ -1132,7 +1128,7 @@ sk_sp<GrRenderTask> GrSurfaceContext::copy(sk_sp<GrSurfaceProxy> src,
|
||||
ASSERT_SINGLE_OWNER
|
||||
RETURN_NULLPTR_IF_ABANDONED
|
||||
SkDEBUGCODE(this->validate();)
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrSurfaceContextPriv::copy");
|
||||
GR_CREATE_TRACE_MARKER_CONTEXT("GrSurfaceContext", "copy", fContext);
|
||||
|
||||
const GrCaps* caps = fContext->priv().caps();
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "src/gpu/GrSurfaceProxy.h"
|
||||
#include "src/gpu/GrSurfaceProxyView.h"
|
||||
|
||||
class GrAuditTrail;
|
||||
class GrDrawingManager;
|
||||
class GrRecordingContext;
|
||||
class GrRenderTargetProxy;
|
||||
@ -191,8 +190,6 @@ public:
|
||||
SkImage::RescaleGamma,
|
||||
SkImage::RescaleMode);
|
||||
|
||||
GrAuditTrail* auditTrail();
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool testCopy(sk_sp<GrSurfaceProxy> src, const SkIRect& srcRect, const SkIPoint& dstPoint) {
|
||||
return this->copy(std::move(src), srcRect, dstPoint) != nullptr;
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "src/core/SkSurfacePriv.h"
|
||||
#include "src/gpu/GrAppliedClip.h"
|
||||
#include "src/gpu/GrAttachment.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrBlurUtils.h"
|
||||
#include "src/gpu/GrCaps.h"
|
||||
#include "src/gpu/GrClip.h"
|
||||
|
@ -18,4 +18,5 @@
|
||||
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context) \
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(context->priv().auditTrail(), classname "::" op); \
|
||||
TRACE_EVENT0("skia.gpu", classname "::" op)
|
||||
|
||||
#endif
|
||||
|
@ -920,7 +920,7 @@ private:
|
||||
} // anonymous namespace
|
||||
|
||||
bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrAAConvexPathRenderer::onDrawPath");
|
||||
SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
|
||||
SkASSERT(!args.fShape->isEmpty());
|
||||
|
@ -1310,7 +1310,7 @@ void AAHairlineOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBoun
|
||||
}
|
||||
|
||||
bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrAAHairlinePathRenderer::onDrawPath");
|
||||
SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
|
||||
|
||||
|
@ -388,7 +388,7 @@ private:
|
||||
} // anonymous namespace
|
||||
|
||||
bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrAALinearizingConvexPathRenderer::onDrawPath");
|
||||
SkASSERT(args.fSurfaceDrawContext->numSamples() <= 1);
|
||||
SkASSERT(!args.fShape->isEmpty());
|
||||
|
@ -29,7 +29,7 @@ GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
|
||||
}
|
||||
|
||||
bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrDashLinePathRenderer::onDrawPath");
|
||||
GrDashOp::AAMode aaMode;
|
||||
switch (args.fAAType) {
|
||||
|
@ -757,7 +757,7 @@ GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
|
||||
}
|
||||
|
||||
bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrDefaultPathRenderer::onDrawPath");
|
||||
GrAAType aaType = (GrAAType::kNone != args.fAAType) ? GrAAType::kMSAA : GrAAType::kNone;
|
||||
|
||||
@ -767,7 +767,7 @@ bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
}
|
||||
|
||||
void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrDefaultPathRenderer::onStencilPath");
|
||||
SkASSERT(!args.fShape->inverseFilled());
|
||||
|
||||
|
@ -694,7 +694,7 @@ private:
|
||||
};
|
||||
|
||||
bool GrSmallPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrSmallPathRenderer::onDrawPath");
|
||||
|
||||
// we've already bailed on inverse filled paths, so this is safe
|
||||
|
@ -583,7 +583,7 @@ private:
|
||||
} // anonymous namespace
|
||||
|
||||
bool GrTriangulatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fSurfaceDrawContext->auditTrail(),
|
||||
GR_AUDIT_TRAIL_AUTO_FRAME(args.fContext->priv().auditTrail(),
|
||||
"GrTriangulatingPathRenderer::onDrawPath");
|
||||
|
||||
GrOp::Owner op = TriangulatingPathOp::Make(
|
||||
|
@ -14,11 +14,12 @@
|
||||
#include "src/gpu/ops/GrFillRectOp.h"
|
||||
#include "src/gpu/tessellate/GrPathStencilCoverOp.h"
|
||||
|
||||
GrAtlasRenderTask::GrAtlasRenderTask(GrRecordingContext* rContext, GrAuditTrail* auditTrail,
|
||||
GrAtlasRenderTask::GrAtlasRenderTask(GrRecordingContext* rContext,
|
||||
sk_sp<GrArenas> arenas,
|
||||
std::unique_ptr<GrDynamicAtlas> dynamicAtlas)
|
||||
: GrOpsTask(rContext->priv().drawingManager(),
|
||||
dynamicAtlas->writeView(*rContext->priv().caps()), auditTrail,
|
||||
dynamicAtlas->writeView(*rContext->priv().caps()),
|
||||
rContext->priv().auditTrail(),
|
||||
std::move(arenas))
|
||||
, fDynamicAtlas(std::move(dynamicAtlas)) {
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ struct SkIPoint16;
|
||||
// call instantiate() at flush time.
|
||||
class GrAtlasRenderTask : public GrOpsTask {
|
||||
public:
|
||||
GrAtlasRenderTask(GrRecordingContext*, GrAuditTrail*, sk_sp<GrArenas>,
|
||||
GrAtlasRenderTask(GrRecordingContext*,
|
||||
sk_sp<GrArenas>,
|
||||
std::unique_ptr<GrDynamicAtlas>);
|
||||
|
||||
const GrTextureProxy* atlasProxy() const { return fDynamicAtlas->textureProxy(); }
|
||||
|
@ -403,7 +403,7 @@ bool GrTessellationPathRenderer::tryAddPathToAtlas(GrRecordingContext* rContext,
|
||||
kAtlasAlpha8Type, GrDynamicAtlas::InternalMultisample::kYes,
|
||||
SkISize{fAtlasInitialSize, fAtlasInitialSize}, fAtlasMaxSize,
|
||||
*rContext->priv().caps(), kAtlasAlgorithm);
|
||||
auto newAtlasTask = sk_make_sp<GrAtlasRenderTask>(rContext, rContext->priv().auditTrail(),
|
||||
auto newAtlasTask = sk_make_sp<GrAtlasRenderTask>(rContext,
|
||||
sk_make_sp<GrArenas>(),
|
||||
std::move(dynamicAtlas));
|
||||
rContext->priv().drawingManager()->addAtlasTask(newAtlasTask, currentAtlasTask);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "src/core/SkCanvasPriv.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
#include "src/core/SkRectPriv.h"
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#include "src/gpu/GrRecordingContextPriv.h"
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
#include "src/utils/SkJSONWriter.h"
|
||||
@ -26,6 +25,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#if SK_GPU_V1
|
||||
#include "src/gpu/GrAuditTrail.h"
|
||||
#endif
|
||||
|
||||
#define SKDEBUGCANVAS_VERSION 1
|
||||
#define SKDEBUGCANVAS_ATTRIBUTE_VERSION "version"
|
||||
#define SKDEBUGCANVAS_ATTRIBUTE_COMMANDS "commands"
|
||||
@ -141,6 +144,7 @@ void DebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) {
|
||||
DebugPaintFilterCanvas filterCanvas(originalCanvas);
|
||||
SkCanvas* finalCanvas = fOverdrawViz ? &filterCanvas : originalCanvas;
|
||||
|
||||
#if SK_GPU_V1
|
||||
auto dContext = GrAsDirectContext(finalCanvas->recordingContext());
|
||||
|
||||
// If we have a GPU backend we can also visualize the op information
|
||||
@ -149,8 +153,10 @@ void DebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) {
|
||||
// The audit trail must be obtained from the original canvas.
|
||||
at = this->getAuditTrail(originalCanvas);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (int i = 0; i <= index; i++) {
|
||||
#if SK_GPU_V1
|
||||
GrAuditTrail::AutoCollectOps* acb = nullptr;
|
||||
if (at) {
|
||||
// We need to flush any pending operations, or they might combine with commands below.
|
||||
@ -161,12 +167,15 @@ void DebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) {
|
||||
}
|
||||
acb = new GrAuditTrail::AutoCollectOps(at, i);
|
||||
}
|
||||
#endif
|
||||
if (fCommandVector[i]->isVisible()) {
|
||||
fCommandVector[i]->execute(finalCanvas);
|
||||
}
|
||||
#if SK_GPU_V1
|
||||
if (at && acb) {
|
||||
delete acb;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (SkColorGetA(fClipVizColor) != 0) {
|
||||
@ -196,6 +205,7 @@ void DebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) {
|
||||
finalCanvas->drawRect(fAndroidClip, androidClipPaint);
|
||||
}
|
||||
|
||||
#if SK_GPU_V1
|
||||
// draw any ops if required and issue a full reset onto GrAuditTrail
|
||||
if (at) {
|
||||
// just in case there is global reordering, we flush the canvas before querying
|
||||
@ -247,8 +257,9 @@ void DebugCanvas::drawTo(SkCanvas* originalCanvas, int index, int m) {
|
||||
}
|
||||
}
|
||||
finalCanvas->restore();
|
||||
this->cleanupAuditTrail(at);
|
||||
}
|
||||
this->cleanupAuditTrail(originalCanvas);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DebugCanvas::deleteDrawCommandAt(int index) {
|
||||
@ -262,6 +273,7 @@ DrawCommand* DebugCanvas::getDrawCommandAt(int index) const {
|
||||
return fCommandVector[index];
|
||||
}
|
||||
|
||||
#if SK_GPU_V1
|
||||
GrAuditTrail* DebugCanvas::getAuditTrail(SkCanvas* canvas) {
|
||||
GrAuditTrail* at = nullptr;
|
||||
auto ctx = canvas->recordingContext();
|
||||
@ -293,21 +305,23 @@ void DebugCanvas::drawAndCollectOps(SkCanvas* canvas) {
|
||||
}
|
||||
}
|
||||
|
||||
void DebugCanvas::cleanupAuditTrail(SkCanvas* canvas) {
|
||||
GrAuditTrail* at = this->getAuditTrail(canvas);
|
||||
void DebugCanvas::cleanupAuditTrail(GrAuditTrail* at) {
|
||||
if (at) {
|
||||
GrAuditTrail::AutoEnable ae(at);
|
||||
at->fullReset();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void DebugCanvas::toJSON(SkJSONWriter& writer,
|
||||
UrlDataManager& urlDataManager,
|
||||
SkCanvas* canvas) {
|
||||
#if SK_GPU_V1
|
||||
this->drawAndCollectOps(canvas);
|
||||
|
||||
// now collect json
|
||||
GrAuditTrail* at = this->getAuditTrail(canvas);
|
||||
#endif
|
||||
writer.appendS32(SKDEBUGCANVAS_ATTRIBUTE_VERSION, SKDEBUGCANVAS_VERSION);
|
||||
writer.beginArray(SKDEBUGCANVAS_ATTRIBUTE_COMMANDS);
|
||||
|
||||
@ -315,29 +329,36 @@ void DebugCanvas::toJSON(SkJSONWriter& writer,
|
||||
writer.beginObject(); // command
|
||||
this->getDrawCommandAt(i)->toJSON(writer, urlDataManager);
|
||||
|
||||
#if SK_GPU_V1
|
||||
if (at) {
|
||||
writer.appendName(SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL);
|
||||
at->toJson(writer, i);
|
||||
}
|
||||
#endif
|
||||
writer.endObject(); // command
|
||||
}
|
||||
|
||||
writer.endArray(); // commands
|
||||
this->cleanupAuditTrail(canvas);
|
||||
#if SK_GPU_V1
|
||||
this->cleanupAuditTrail(at);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DebugCanvas::toJSONOpsTask(SkJSONWriter& writer, SkCanvas* canvas) {
|
||||
#if SK_GPU_V1
|
||||
this->drawAndCollectOps(canvas);
|
||||
|
||||
GrAuditTrail* at = this->getAuditTrail(canvas);
|
||||
if (at) {
|
||||
GrAuditTrail::AutoManageOpsTask enable(at);
|
||||
at->toJson(writer);
|
||||
} else {
|
||||
writer.beginObject();
|
||||
writer.endObject();
|
||||
this->cleanupAuditTrail(at);
|
||||
return;
|
||||
}
|
||||
this->cleanupAuditTrail(canvas);
|
||||
#endif
|
||||
|
||||
writer.beginObject();
|
||||
writer.endObject();
|
||||
}
|
||||
|
||||
void DebugCanvas::setOverdrawViz(bool overdrawViz) { fOverdrawViz = overdrawViz; }
|
||||
|
@ -231,10 +231,11 @@ private:
|
||||
*/
|
||||
void addDrawCommand(DrawCommand* command);
|
||||
|
||||
#if SK_GPU_V1
|
||||
GrAuditTrail* getAuditTrail(SkCanvas*);
|
||||
|
||||
void drawAndCollectOps(SkCanvas*);
|
||||
void cleanupAuditTrail(SkCanvas*);
|
||||
void cleanupAuditTrail(GrAuditTrail*);
|
||||
#endif
|
||||
|
||||
using INHERITED = SkCanvasVirtualEnforcer<SkCanvas>;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user