diff options
author | joshualitt <joshualitt@chromium.org> | 2016-03-01 07:15:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-01 07:15:52 -0800 |
commit | 1d7decffbc34a438fe5eacda17211a10ba72eac2 (patch) | |
tree | acf697c576ac4584f8c7b4ee705a9b180c9a2342 /tools | |
parent | fd5a26080d4647cc913f5f2b2dc72cb35abac3ab (diff) |
SkDebugCanvas ignore batch bounds if they are offscreen
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1754633002
Review URL: https://codereview.chromium.org/1754633002
Diffstat (limited to 'tools')
-rw-r--r-- | tools/debugger/SkDebugCanvas.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp index 91f88d2b66..713ac39cfa 100644 --- a/tools/debugger/SkDebugCanvas.cpp +++ b/tools/debugger/SkDebugCanvas.cpp @@ -17,6 +17,7 @@ #include "GrAuditTrail.h" #include "GrContext.h" #include "GrRenderTarget.h" +#include "SkGpuDevice.h" #endif #define SKDEBUGCANVAS_VERSION 1 @@ -330,6 +331,12 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { #if SK_SUPPORT_GPU // draw any batches if required and issue a full reset onto GrAuditTrail if (at) { + // get the render target of the top device so we can ignore batches drawn offscreen + SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_testing(); + SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd); + uint32_t rtID = gbd->accessRenderTarget()->getUniqueID(); + + // get the bounding boxes to draw GrAuditTrail::AutoEnable ae(at); SkTArray<GrAuditTrail::BatchInfo> childrenBounds; at->getBoundsByClientID(&childrenBounds, index); @@ -337,6 +344,10 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { paint.setStyle(SkPaint::kStroke_Style); paint.setStrokeWidth(1); for (int i = 0; i < childrenBounds.count(); i++) { + if (childrenBounds[i].fRenderTargetUniqueID != rtID) { + // offscreen draw, ignore for now + continue; + } paint.setColor(SK_ColorBLACK); canvas->drawRect(childrenBounds[i].fBounds, paint); for (int j = 0; j < childrenBounds[i].fBatches.count(); j++) { |