aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2016-03-01 07:15:52 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-01 07:15:52 -0800
commit1d7decffbc34a438fe5eacda17211a10ba72eac2 (patch)
treeacf697c576ac4584f8c7b4ee705a9b180c9a2342 /tools
parentfd5a26080d4647cc913f5f2b2dc72cb35abac3ab (diff)
SkDebugCanvas ignore batch bounds if they are offscreen
Diffstat (limited to 'tools')
-rw-r--r--tools/debugger/SkDebugCanvas.cpp11
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++) {