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

Unified Diff: tools/debugger/SkDebugCanvas.cpp

Issue 1754633002: SkDebugCanvas ignore batch bounds if they are offscreen (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: 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 | « src/gpu/GrAuditTrail.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/debugger/SkDebugCanvas.cpp
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 4fc6d14625899a1f3adde43aece27213b6125f1a..1d727be8a5b84f77b9dd5ef0eab4aab24c261805 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();
bsalomon 2016/03/01 14:50:12 Don't love it but it's the best we have for now. l
+ 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++) {
« no previous file with comments | « src/gpu/GrAuditTrail.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698