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

Side by Side Diff: tools/debugger/SkDebugCanvas.cpp

Issue 1765123002: Fix up GrAuditTrail to allow arbitrary reordering (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fix up audit trail 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/GrDrawTarget.cpp ('k') | tools/skiaserve/Request.cpp » ('j') | 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"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 if (fPaintFilterCanvas) { 328 if (fPaintFilterCanvas) {
329 fPaintFilterCanvas->removeAll(); 329 fPaintFilterCanvas->removeAll();
330 } 330 }
331 331
332 #if SK_SUPPORT_GPU 332 #if SK_SUPPORT_GPU
333 // draw any batches if required and issue a full reset onto GrAuditTrail 333 // draw any batches if required and issue a full reset onto GrAuditTrail
334 if (at) { 334 if (at) {
335 // just in case there is global reordering, we flush the canvas before q uerying 335 // just in case there is global reordering, we flush the canvas before q uerying
336 // GrAuditTrail 336 // GrAuditTrail
337 GrAuditTrail::AutoEnable ae(at);
337 canvas->flush(); 338 canvas->flush();
338 339
339 // we pick three colorblind-safe colors, 75% alpha 340 // we pick three colorblind-safe colors, 75% alpha
340 static const SkColor kTotalBounds = SkColorSetARGB(0xC0, 0x6A, 0x3D, 0x9 A); 341 static const SkColor kTotalBounds = SkColorSetARGB(0xC0, 0x6A, 0x3D, 0x9 A);
341 static const SkColor kOpBatchBounds = SkColorSetARGB(0xC0, 0xE3, 0x1A, 0 x1C); 342 static const SkColor kOpBatchBounds = SkColorSetARGB(0xC0, 0xE3, 0x1A, 0 x1C);
342 static const SkColor kOtherBatchBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F , 0x00); 343 static const SkColor kOtherBatchBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F , 0x00);
343 344
344 // get the render target of the top device so we can ignore batches draw n offscreen 345 // get the render target of the top device so we can ignore batches draw n offscreen
345 SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_t esting(); 346 SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_t esting();
346 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd); 347 SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd);
347 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID(); 348 uint32_t rtID = gbd->accessRenderTarget()->getUniqueID();
348 349
349 // get the bounding boxes to draw 350 // get the bounding boxes to draw
350 GrAuditTrail::AutoEnable ae(at);
351 SkTArray<GrAuditTrail::BatchInfo> childrenBounds; 351 SkTArray<GrAuditTrail::BatchInfo> childrenBounds;
352 if (m == -1) { 352 if (m == -1) {
353 at->getBoundsByClientID(&childrenBounds, index); 353 at->getBoundsByClientID(&childrenBounds, index);
354 } else { 354 } else {
355 // the client wants us to draw the mth batch 355 // the client wants us to draw the mth batch
356 at->getBoundsByBatchListID(&childrenBounds.push_back(), m); 356 at->getBoundsByBatchListID(&childrenBounds.push_back(), m);
357 } 357 }
358 SkPaint paint; 358 SkPaint paint;
359 paint.setStyle(SkPaint::kStroke_Style); 359 paint.setStyle(SkPaint::kStroke_Style);
360 paint.setStrokeWidth(1); 360 paint.setStrokeWidth(1);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 at = ctx->getAuditTrail(); 427 at = ctx->getAuditTrail();
428 428
429 // loop over all of the commands and draw them, this is to collect r eordering 429 // loop over all of the commands and draw them, this is to collect r eordering
430 // information 430 // information
431 for (int i = 0; i < this->getSize() && i <= n; i++) { 431 for (int i = 0; i < this->getSize() && i <= n; i++) {
432 GrAuditTrail::AutoCollectBatches enable(at, i); 432 GrAuditTrail::AutoCollectBatches enable(at, i);
433 fCommandVector[i]->execute(canvas); 433 fCommandVector[i]->execute(canvas);
434 } 434 }
435 435
436 // in case there is some kind of global reordering 436 // in case there is some kind of global reordering
437 canvas->flush(); 437 {
438 GrAuditTrail::AutoEnable ae(at);
439 canvas->flush();
440 }
438 } 441 }
439 } 442 }
440 #endif 443 #endif
441 444
442 // now collect json 445 // now collect json
443 Json::Value result = Json::Value(Json::objectValue); 446 Json::Value result = Json::Value(Json::objectValue);
444 result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION) ; 447 result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION) ;
445 Json::Value commands = Json::Value(Json::arrayValue); 448 Json::Value commands = Json::Value(Json::arrayValue);
446 for (int i = 0; i < this->getSize() && i <= n; i++) { 449 for (int i = 0; i < this->getSize() && i <= n; i++) {
447 commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager); 450 commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager);
448 #if SK_SUPPORT_GPU 451 #if SK_SUPPORT_GPU
449 if (at) { 452 if (at) {
450 // TODO if this is inefficient we could add a method to GrAuditTrail which takes 453 // TODO if this is inefficient we could add a method to GrAuditTrail which takes
451 // a Json::Value and is only compiled in this file 454 // a Json::Value and is only compiled in this file
452 Json::Value parsedFromString; 455 Json::Value parsedFromString;
453 Json::Reader reader; 456 Json::Reader reader;
454 SkAssertResult(reader.parse(at->toJson(i).c_str(), parsedFromString) ); 457 SkAssertResult(reader.parse(at->toJson(i).c_str(), parsedFromString) );
455 458
456 commands[i][SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL] = parsedFromString; 459 commands[i][SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL] = parsedFromString;
457 } 460 }
458 #endif 461 #endif
459 } 462 }
460 #if SK_SUPPORT_GPU 463 #if SK_SUPPORT_GPU
461 if (at) { 464 if (at) {
465 GrAuditTrail::AutoEnable ae(at);
462 at->fullReset(); 466 at->fullReset();
463 } 467 }
464 #endif 468 #endif
465 result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands; 469 result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands;
466 return result; 470 return result;
467 } 471 }
468 472
469 void SkDebugCanvas::updatePaintFilterCanvas() { 473 void SkDebugCanvas::updatePaintFilterCanvas() {
470 if (!fOverdrawViz && !fOverrideFilterQuality) { 474 if (!fOverdrawViz && !fOverrideFilterQuality) {
471 fPaintFilterCanvas.reset(nullptr); 475 fPaintFilterCanvas.reset(nullptr);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 } 772 }
769 773
770 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 774 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
771 if (fCalledAddStackData) { 775 if (fCalledAddStackData) {
772 fClipStackData.appendf("<br>"); 776 fClipStackData.appendf("<br>");
773 addPathData(devPath, "pathOut"); 777 addPathData(devPath, "pathOut");
774 return true; 778 return true;
775 } 779 }
776 return false; 780 return false;
777 } 781 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | tools/skiaserve/Request.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698