aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/mdbviz/Model.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mdbviz/Model.cpp')
-rw-r--r--tools/mdbviz/Model.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/mdbviz/Model.cpp b/tools/mdbviz/Model.cpp
index a3f8e1ae87..c2929568f4 100644
--- a/tools/mdbviz/Model.cpp
+++ b/tools/mdbviz/Model.cpp
@@ -61,10 +61,25 @@ const char* Model::ErrorString(ErrorCode err) {
return kStrings[(int)err];
}
-const char* Model::getOpName(int index) {
+const char* Model::getOpName(int index) const {
return SkDrawCommand::GetCommandString(fOps[index]->getType());
}
+bool Model::isHierarchyPush(int index) const {
+ SkDrawCommand::OpType type = fOps[index]->getType();
+
+ return SkDrawCommand::kSave_OpType == type ||
+ SkDrawCommand::kSaveLayer_OpType == type ||
+ SkDrawCommand::kBeginDrawPicture_OpType == type;
+}
+
+bool Model::isHierarchyPop(int index) const {
+ SkDrawCommand::OpType type = fOps[index]->getType();
+
+ return SkDrawCommand::kRestore_OpType == type ||
+ SkDrawCommand::kEndDrawPicture_OpType == type;
+}
+
void Model::setCurOp(int curOp) {
SkASSERT(curOp < fOps.count());
@@ -96,5 +111,6 @@ void Model::resetOpList() {
for (int i = 0; i < fOps.count(); ++i) {
delete fOps[i];
}
+ fOps.reset();
fCurOp = 0;
}