Added more features to deletes and breakpoints
Review URL: https://codereview.appspot.com/6406050
git-svn-id: http://skia.googlecode.com/svn/trunk@4637 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/SkDebugCanvas.cpp b/debugger/SkDebugCanvas.cpp
index 8586878..c811a05 100644
--- a/debugger/SkDebugCanvas.cpp
+++ b/debugger/SkDebugCanvas.cpp
@@ -73,32 +73,18 @@
}
SkDrawCommand* SkDebugCanvas::getDrawCommandAt(int index) {
- int counter = 0;
- if(!commandVector.empty()) {
- for(it = commandVector.begin(); it != commandVector.end(); ++it) {
- if (counter==index) {
- return (*it);
- }
- ++counter;
- }
- }
- return NULL;
+ SkASSERT(index < commandVector.size());
+ return commandVector[index];
}
std::vector<std::string>* SkDebugCanvas::getCommandInfoAt(int index) {
- std::string info;
+ SkASSERT(index < commandVector.size());
+ return commandVector[index]->Info();
+}
- int counter = 0;
- if(!commandVector.empty()) {
- for(it = commandVector.begin(); it != commandVector.end(); ++it) {
- if (counter==index) {
- return (*it)->Info();
- }
- ++counter;
- }
- }
-
- return NULL;
+bool SkDebugCanvas::getDrawCommandVisibilityAt(int index) {
+ SkASSERT(index < commandVector.size());
+ return commandVector[index]->getVisibility();
}
std::vector<SkDrawCommand*> SkDebugCanvas::getDrawCommands() {
@@ -262,30 +248,7 @@
return true;
}
-void SkDebugCanvas::toggleCommand(int index) {
- int counter = 0;
- if(!commandVector.empty()) {
- for(it = commandVector.begin(); it != commandVector.end(); ++it) {
- if (counter == index) {
- if ((*it)->getVisibility()) {
- (*it)->setVisibility(false);
- } else {
- (*it)->setVisibility(true);
- }
- }
- counter++;
- }
- }
-}
-
void SkDebugCanvas::toggleCommand(int index, bool toggle) {
- int counter = 0;
- if(!commandVector.empty()) {
- for(it = commandVector.begin(); it != commandVector.end(); ++it) {
- if (counter == index) {
- (*it)->setVisibility(toggle);
- }
- counter++;
- }
- }
+ SkASSERT(index < commandVector.size());
+ commandVector[index]->setVisibility(toggle);
}