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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrAuditTrail.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCanvasPriv.h" 8 #include "SkCanvasPriv.h"
9 #include "SkClipStack.h" 9 #include "SkClipStack.h"
10 #include "SkDebugCanvas.h" 10 #include "SkDebugCanvas.h"
11 #include "SkDrawCommand.h" 11 #include "SkDrawCommand.h"
12 #include "SkDevice.h" 12 #include "SkDevice.h"
13 #include "SkPaintFilterCanvas.h" 13 #include "SkPaintFilterCanvas.h"
14 #include "SkOverdrawMode.h" 14 #include "SkOverdrawMode.h"
15 15
16 #if SK_SUPPORT_GPU 16 #if SK_SUPPORT_GPU
17 #include "GrAuditTrail.h" 17 #include "GrAuditTrail.h"
18 #include "GrContext.h" 18 #include "GrContext.h"
19 #include "GrRenderTarget.h" 19 #include "GrRenderTarget.h"
20 #include "SkGpuDevice.h"
20 #endif 21 #endif
21 22
22 #define SKDEBUGCANVAS_VERSION 1 23 #define SKDEBUGCANVAS_VERSION 1
23 #define SKDEBUGCANVAS_ATTRIBUTE_VERSION "version" 24 #define SKDEBUGCANVAS_ATTRIBUTE_VERSION "version"
24 #define SKDEBUGCANVAS_ATTRIBUTE_COMMANDS "commands" 25 #define SKDEBUGCANVAS_ATTRIBUTE_COMMANDS "commands"
25 26
26 class DebugPaintFilterCanvas : public SkPaintFilterCanvas { 27 class DebugPaintFilterCanvas : public SkPaintFilterCanvas {
27 public: 28 public:
28 DebugPaintFilterCanvas(int width, 29 DebugPaintFilterCanvas(int width,
29 int height, 30 int height,
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 324
324 canvas->restoreToCount(saveCount); 325 canvas->restoreToCount(saveCount);
325 326
326 if (fPaintFilterCanvas) { 327 if (fPaintFilterCanvas) {
327 fPaintFilterCanvas->removeAll(); 328 fPaintFilterCanvas->removeAll();
328 } 329 }
329 330
330 #if SK_SUPPORT_GPU 331 #if SK_SUPPORT_GPU
331 // draw any batches if required and issue a full reset onto GrAuditTrail 332 // draw any batches if required and issue a full reset onto GrAuditTrail
332 if (at) { 333 if (at) {
334 // get the render target of the top device so we can ignore batches draw n offscreen
335 SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_t esting();
bsalomon 2016/03/01 14:50:12 Don't love it but it's the best we have for now. l
336 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd);
337 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID();
338
339 // get the bounding boxes to draw
333 GrAuditTrail::AutoEnable ae(at); 340 GrAuditTrail::AutoEnable ae(at);
334 SkTArray<GrAuditTrail::BatchInfo> childrenBounds; 341 SkTArray<GrAuditTrail::BatchInfo> childrenBounds;
335 at->getBoundsByClientID(&childrenBounds, index); 342 at->getBoundsByClientID(&childrenBounds, index);
336 SkPaint paint; 343 SkPaint paint;
337 paint.setStyle(SkPaint::kStroke_Style); 344 paint.setStyle(SkPaint::kStroke_Style);
338 paint.setStrokeWidth(1); 345 paint.setStrokeWidth(1);
339 for (int i = 0; i < childrenBounds.count(); i++) { 346 for (int i = 0; i < childrenBounds.count(); i++) {
347 if (childrenBounds[i].fRenderTargetUniqueID != rtID) {
348 // offscreen draw, ignore for now
349 continue;
350 }
340 paint.setColor(SK_ColorBLACK); 351 paint.setColor(SK_ColorBLACK);
341 canvas->drawRect(childrenBounds[i].fBounds, paint); 352 canvas->drawRect(childrenBounds[i].fBounds, paint);
342 for (int j = 0; j < childrenBounds[i].fBatches.count(); j++) { 353 for (int j = 0; j < childrenBounds[i].fBatches.count(); j++) {
343 const GrAuditTrail::BatchInfo::Batch& batch = childrenBounds[i]. fBatches[j]; 354 const GrAuditTrail::BatchInfo::Batch& batch = childrenBounds[i]. fBatches[j];
344 if (batch.fClientID != index) { 355 if (batch.fClientID != index) {
345 paint.setColor(SK_ColorBLUE); 356 paint.setColor(SK_ColorBLUE);
346 } else { 357 } else {
347 paint.setColor(SK_ColorRED); 358 paint.setColor(SK_ColorRED);
348 } 359 }
349 canvas->drawRect(batch.fBounds, paint); 360 canvas->drawRect(batch.fBounds, paint);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 716 }
706 717
707 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 718 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
708 if (fCalledAddStackData) { 719 if (fCalledAddStackData) {
709 fClipStackData.appendf("<br>"); 720 fClipStackData.appendf("<br>");
710 addPathData(devPath, "pathOut"); 721 addPathData(devPath, "pathOut");
711 return true; 722 return true;
712 } 723 }
713 return false; 724 return false;
714 } 725 }
OLDNEW
« 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