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

Unified Diff: src/utils/debugger/SkDebugCanvas.cpp

Issue 177423013: Add cull rect visualization to debugger (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 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/utils/debugger/SkDebugCanvas.h ('k') | src/utils/debugger/SkDrawCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/debugger/SkDebugCanvas.cpp
===================================================================
--- src/utils/debugger/SkDebugCanvas.cpp (revision 13645)
+++ src/utils/debugger/SkDebugCanvas.cpp (working copy)
@@ -197,8 +197,9 @@
// set up the saveLayer commands so that the active ones
// return true in their 'active' method
-void SkDebugCanvas::markActiveSaveLayers(int index) {
- SkTDArray<SkDrawCommand*> activeLayers;
+void SkDebugCanvas::markActiveCommands(int index) {
+ fActiveLayers.rewind();
+ fActiveCulls.rewind();
for (int i = 0; i < fCommandVector.count(); ++i) {
fCommandVector[i]->setActive(false);
@@ -206,16 +207,24 @@
for (int i = 0; i < index; ++i) {
SkDrawCommand::Action result = fCommandVector[i]->action();
- if (SkDrawCommand::kPush_Action == result) {
- activeLayers.push(fCommandVector[i]);
- } else if (SkDrawCommand::kPop_Action == result) {
- activeLayers.pop();
+ if (SkDrawCommand::kPushLayer_Action == result) {
+ fActiveLayers.push(fCommandVector[i]);
+ } else if (SkDrawCommand::kPopLayer_Action == result) {
+ fActiveLayers.pop();
+ } else if (SkDrawCommand::kPushCull_Action == result) {
+ fActiveCulls.push(fCommandVector[i]);
+ } else if (SkDrawCommand::kPopCull_Action == result) {
+ fActiveCulls.pop();
}
}
- for (int i = 0; i < activeLayers.count(); ++i) {
- activeLayers[i]->setActive(true);
+ for (int i = 0; i < fActiveLayers.count(); ++i) {
+ fActiveLayers[i]->setActive(true);
}
+
+ for (int i = 0; i < fActiveCulls.count(); ++i) {
+ fActiveCulls[i]->setActive(true);
+ }
}
void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
@@ -268,7 +277,7 @@
}
if (fMegaVizMode) {
- this->markActiveSaveLayers(index);
+ this->markActiveCommands(index);
}
for (; i <= index; i++) {
@@ -288,14 +297,16 @@
if (fCommandVector[i]->isVisible()) {
if (fMegaVizMode && fCommandVector[i]->active()) {
- // All active saveLayers get replaced with saves so all draws go to the
- // visible canvas
- canvas->save();
- ++fOutstandingSaveCount;
+ // "active" commands execute their visualization behaviors:
+ // All active saveLayers get replaced with saves so all draws go to the
+ // visible canvas.
+ // All active culls draw their cull box
+ fCommandVector[i]->vizExecute(canvas);
} else {
fCommandVector[i]->execute(canvas);
- fCommandVector[i]->trackSaveState(&fOutstandingSaveCount);
}
+
+ fCommandVector[i]->trackSaveState(&fOutstandingSaveCount);
}
}
« no previous file with comments | « src/utils/debugger/SkDebugCanvas.h ('k') | src/utils/debugger/SkDrawCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698