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

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

Issue 1787843002: Fix up no gpu build (Closed) Base URL: https://skia.googlesource.com/skia.git@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 | « no previous file | tools/skiaserve/Request.h » ('j') | tools/skiaserve/Request.h » ('J')
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (fPaintFilterCanvas) { 218 if (fPaintFilterCanvas) {
219 fPaintFilterCanvas->addCanvas(canvas); 219 fPaintFilterCanvas->addCanvas(canvas);
220 canvas = fPaintFilterCanvas.get(); 220 canvas = fPaintFilterCanvas.get();
221 221
222 } 222 }
223 223
224 if (fMegaVizMode) { 224 if (fMegaVizMode) {
225 this->markActiveCommands(index); 225 this->markActiveCommands(index);
226 } 226 }
227 227
228 #if SK_SUPPORT_GPU
228 // If we have a GPU backend we can also visualize the batching information 229 // If we have a GPU backend we can also visualize the batching information
229 GrAuditTrail* at = nullptr; 230 GrAuditTrail* at = nullptr;
230 if (fDrawGpuBatchBounds || m != -1) { 231 if (fDrawGpuBatchBounds || m != -1) {
231 at = this->getAuditTrail(canvas); 232 at = this->getAuditTrail(canvas);
232 } 233 }
234 #endif
233 235
234 for (int i = 0; i <= index; i++) { 236 for (int i = 0; i <= index; i++) {
235 if (i == index && fFilter) { 237 if (i == index && fFilter) {
236 canvas->clear(0xAAFFFFFF); 238 canvas->clear(0xAAFFFFFF);
237 } 239 }
238 240
239 #if SK_SUPPORT_GPU 241 #if SK_SUPPORT_GPU
240 GrAuditTrail::AutoCollectBatches* acb = nullptr; 242 GrAuditTrail::AutoCollectBatches* acb = nullptr;
241 if (at) { 243 if (at) {
242 acb = new GrAuditTrail::AutoCollectBatches(at, i); 244 acb = new GrAuditTrail::AutoCollectBatches(at, i);
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 GrContext* ctx = rt->getContext(); 419 GrContext* ctx = rt->getContext();
418 if (ctx) { 420 if (ctx) {
419 at = ctx->getAuditTrail(); 421 at = ctx->getAuditTrail();
420 } 422 }
421 } 423 }
422 #endif 424 #endif
423 return at; 425 return at;
424 } 426 }
425 427
426 void SkDebugCanvas::drawAndCollectBatches(int n, SkCanvas* canvas) { 428 void SkDebugCanvas::drawAndCollectBatches(int n, SkCanvas* canvas) {
429 #if SK_SUPPORT_GPU
427 GrAuditTrail* at = this->getAuditTrail(canvas); 430 GrAuditTrail* at = this->getAuditTrail(canvas);
428 if (at) { 431 if (at) {
429 #if SK_SUPPORT_GPU
430 // loop over all of the commands and draw them, this is to collect reord ering 432 // loop over all of the commands and draw them, this is to collect reord ering
431 // information 433 // information
432 for (int i = 0; i < this->getSize() && i <= n; i++) { 434 for (int i = 0; i < this->getSize() && i <= n; i++) {
433 GrAuditTrail::AutoCollectBatches enable(at, i); 435 GrAuditTrail::AutoCollectBatches enable(at, i);
434 fCommandVector[i]->execute(canvas); 436 fCommandVector[i]->execute(canvas);
435 } 437 }
436 438
437 // in case there is some kind of global reordering 439 // in case there is some kind of global reordering
438 { 440 {
439 GrAuditTrail::AutoEnable ae(at); 441 GrAuditTrail::AutoEnable ae(at);
440 canvas->flush(); 442 canvas->flush();
441 } 443 }
444 }
442 #endif 445 #endif
443 }
444 } 446 }
445 447
446 void SkDebugCanvas::cleanupAuditTrail(SkCanvas* canvas) { 448 void SkDebugCanvas::cleanupAuditTrail(SkCanvas* canvas) {
447 GrAuditTrail* at = this->getAuditTrail(canvas); 449 GrAuditTrail* at = this->getAuditTrail(canvas);
448 if (at) { 450 if (at) {
449 #if SK_SUPPORT_GPU 451 #if SK_SUPPORT_GPU
450 GrAuditTrail::AutoEnable ae(at); 452 GrAuditTrail::AutoEnable ae(at);
451 at->fullReset(); 453 at->fullReset();
452 #endif 454 #endif
453 } 455 }
454 } 456 }
455 457
456 Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva s* canvas) { 458 Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva s* canvas) {
457 this->drawAndCollectBatches(n, canvas); 459 this->drawAndCollectBatches(n, canvas);
458 460
459 // now collect json 461 // now collect json
462 #if SK_SUPPORT_GPU
460 GrAuditTrail* at = this->getAuditTrail(canvas); 463 GrAuditTrail* at = this->getAuditTrail(canvas);
464 #endif
461 Json::Value result = Json::Value(Json::objectValue); 465 Json::Value result = Json::Value(Json::objectValue);
462 result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION) ; 466 result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION) ;
463 Json::Value commands = Json::Value(Json::arrayValue); 467 Json::Value commands = Json::Value(Json::arrayValue);
464 for (int i = 0; i < this->getSize() && i <= n; i++) { 468 for (int i = 0; i < this->getSize() && i <= n; i++) {
465 commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager); 469 commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager);
466 #if SK_SUPPORT_GPU 470 #if SK_SUPPORT_GPU
467 if (at) { 471 if (at) {
468 // TODO if this is inefficient we could add a method to GrAuditTrail which takes 472 // TODO if this is inefficient we could add a method to GrAuditTrail which takes
469 // a Json::Value and is only compiled in this file 473 // a Json::Value and is only compiled in this file
470 Json::Value parsedFromString; 474 Json::Value parsedFromString;
471 Json::Reader reader; 475 Json::Reader reader;
472 SkAssertResult(reader.parse(at->toJson(i).c_str(), parsedFromString) ); 476 SkAssertResult(reader.parse(at->toJson(i).c_str(), parsedFromString) );
473 477
474 commands[i][SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL] = parsedFromString; 478 commands[i][SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL] = parsedFromString;
475 } 479 }
476 #endif 480 #endif
477 } 481 }
478 this->cleanupAuditTrail(canvas); 482 this->cleanupAuditTrail(canvas);
479 result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands; 483 result[SKDEBUGCANVAS_ATTRIBUTE_COMMANDS] = commands;
480 return result; 484 return result;
481 } 485 }
482 486
483 Json::Value SkDebugCanvas::toJSONBatchList(int n, SkCanvas* canvas) { 487 Json::Value SkDebugCanvas::toJSONBatchList(int n, SkCanvas* canvas) {
484 this->drawAndCollectBatches(n, canvas); 488 this->drawAndCollectBatches(n, canvas);
485 489
486 Json::Value parsedFromString; 490 Json::Value parsedFromString;
491 #if SK_SUPPORT_GPU
487 GrAuditTrail* at = this->getAuditTrail(canvas); 492 GrAuditTrail* at = this->getAuditTrail(canvas);
488 #if SK_SUPPORT_GPU
489 if (at) { 493 if (at) {
490 GrAuditTrail::AutoManageBatchList enable(at); 494 GrAuditTrail::AutoManageBatchList enable(at);
491 Json::Reader reader; 495 Json::Reader reader;
492 SkAssertResult(reader.parse(at->toJson().c_str(), parsedFromString)); 496 SkAssertResult(reader.parse(at->toJson().c_str(), parsedFromString));
493 } 497 }
494 #endif 498 #endif
495 this->cleanupAuditTrail(canvas); 499 this->cleanupAuditTrail(canvas);
496 return parsedFromString; 500 return parsedFromString;
497 } 501 }
498 502
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 802 }
799 803
800 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { 804 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) {
801 if (fCalledAddStackData) { 805 if (fCalledAddStackData) {
802 fClipStackData.appendf("<br>"); 806 fClipStackData.appendf("<br>");
803 addPathData(devPath, "pathOut"); 807 addPathData(devPath, "pathOut");
804 return true; 808 return true;
805 } 809 }
806 return false; 810 return false;
807 } 811 }
OLDNEW
« no previous file with comments | « no previous file | tools/skiaserve/Request.h » ('j') | tools/skiaserve/Request.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698