| OLD | NEW |
| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 canvas->clear(SK_ColorWHITE); | 211 canvas->clear(SK_ColorWHITE); |
| 212 canvas->resetMatrix(); | 212 canvas->resetMatrix(); |
| 213 if (!windowRect.isEmpty()) { | 213 if (!windowRect.isEmpty()) { |
| 214 canvas->clipRect(windowRect, SkRegion::kReplace_Op); | 214 canvas->clipRect(windowRect, SkRegion::kReplace_Op); |
| 215 } | 215 } |
| 216 this->applyUserTransform(canvas); | 216 this->applyUserTransform(canvas); |
| 217 | 217 |
| 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 SK_SUPPORT_GPU |
| 229 // 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 |
| 230 GrAuditTrail* at = nullptr; | 230 GrAuditTrail* at = nullptr; |
| 231 if (fDrawGpuBatchBounds || m != -1) { | 231 if (fDrawGpuBatchBounds || m != -1) { |
| 232 at = this->getAuditTrail(canvas); | 232 at = this->getAuditTrail(canvas); |
| 233 } | 233 } |
| 234 #endif | 234 #endif |
| 235 | 235 |
| 236 for (int i = 0; i <= index; i++) { | 236 for (int i = 0; i <= index; i++) { |
| 237 if (i == index && fFilter) { | 237 if (i == index && fFilter) { |
| 238 canvas->clear(0xAAFFFFFF); | 238 canvas->clear(0xAAFFFFFF); |
| 239 } | 239 } |
| 240 | 240 |
| 241 #if SK_SUPPORT_GPU | 241 #if SK_SUPPORT_GPU |
| 242 GrAuditTrail::AutoCollectBatches* acb = nullptr; | 242 GrAuditTrail::AutoCollectBatches* acb = nullptr; |
| 243 if (at) { | 243 if (at) { |
| 244 acb = new GrAuditTrail::AutoCollectBatches(at, i); | 244 acb = new GrAuditTrail::AutoCollectBatches(at, i); |
| 245 } | 245 } |
| 246 #endif | 246 #endif |
| 247 | 247 |
| 248 if (fCommandVector[i]->isVisible()) { | 248 if (fCommandVector[i]->isVisible()) { |
| 249 if (fMegaVizMode && fCommandVector[i]->active()) { | 249 if (fMegaVizMode && fCommandVector[i]->active()) { |
| 250 // "active" commands execute their visualization behaviors: | 250 // "active" commands execute their visualization behaviors: |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 if (at) { | 450 if (at) { |
| 451 #if SK_SUPPORT_GPU | 451 #if SK_SUPPORT_GPU |
| 452 GrAuditTrail::AutoEnable ae(at); | 452 GrAuditTrail::AutoEnable ae(at); |
| 453 at->fullReset(); | 453 at->fullReset(); |
| 454 #endif | 454 #endif |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 | 457 |
| 458 Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva
s* canvas) { | 458 Json::Value SkDebugCanvas::toJSON(UrlDataManager& urlDataManager, int n, SkCanva
s* canvas) { |
| 459 this->drawAndCollectBatches(n, canvas); | 459 this->drawAndCollectBatches(n, canvas); |
| 460 | 460 |
| 461 // now collect json | 461 // now collect json |
| 462 #if SK_SUPPORT_GPU | 462 #if SK_SUPPORT_GPU |
| 463 GrAuditTrail* at = this->getAuditTrail(canvas); | 463 GrAuditTrail* at = this->getAuditTrail(canvas); |
| 464 #endif | 464 #endif |
| 465 Json::Value result = Json::Value(Json::objectValue); | 465 Json::Value result = Json::Value(Json::objectValue); |
| 466 result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION)
; | 466 result[SKDEBUGCANVAS_ATTRIBUTE_VERSION] = Json::Value(SKDEBUGCANVAS_VERSION)
; |
| 467 Json::Value commands = Json::Value(Json::arrayValue); | 467 Json::Value commands = Json::Value(Json::arrayValue); |
| 468 for (int i = 0; i < this->getSize() && i <= n; i++) { | 468 for (int i = 0; i < this->getSize() && i <= n; i++) { |
| 469 commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager); | 469 commands[i] = this->getDrawCommandAt(i)->toJSON(urlDataManager); |
| 470 #if SK_SUPPORT_GPU | 470 #if SK_SUPPORT_GPU |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 } | 802 } |
| 803 | 803 |
| 804 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { | 804 bool SkDebugCanvas::lastClipStackData(const SkPath& devPath) { |
| 805 if (fCalledAddStackData) { | 805 if (fCalledAddStackData) { |
| 806 fClipStackData.appendf("<br>"); | 806 fClipStackData.appendf("<br>"); |
| 807 addPathData(devPath, "pathOut"); | 807 addPathData(devPath, "pathOut"); |
| 808 return true; | 808 return true; |
| 809 } | 809 } |
| 810 return false; | 810 return false; |
| 811 } | 811 } |
| OLD | NEW |