Debugger: remove dead feature (SkPicture offset display) & fix bug (unbalanced indents)

Displaying the offset into an SkPicture hasn't worked for a while so this CL deletes the feature.
When "Save Layer" was renamed to "SaveLayer" the code that computes the indent in the list view was broken. This CL patches the problem.

Review URL: https://codereview.chromium.org/1034733004
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index ea3564c..c51f242 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -32,7 +32,6 @@
     , fToolBar(this)
     , fActionOpen(this)
     , fActionBreakpoint(this)
-    , fActionToggleIndexStyle(this)
     , fActionProfile(this)
     , fActionCancel(this)
     , fActionClearBreakpoints(this)
@@ -79,7 +78,6 @@
     connect(&fActionStepBack, SIGNAL(triggered()), this, SLOT(actionStepBack()));
     connect(&fActionStepForward, SIGNAL(triggered()), this, SLOT(actionStepForward()));
     connect(&fActionBreakpoint, SIGNAL(triggered()), this, SLOT(actionBreakpoints()));
-    connect(&fActionToggleIndexStyle, SIGNAL(triggered()), this, SLOT(actionToggleIndexStyle()));
     connect(&fActionInspector, SIGNAL(triggered()), this, SLOT(actionInspector()));
     connect(&fActionSettings, SIGNAL(triggered()), this, SLOT(actionSettings()));
     connect(&fFilter, SIGNAL(activated(QString)), this, SLOT(toggleFilter(QString)));
@@ -126,14 +124,6 @@
     }
 }
 
-void SkDebuggerGUI::actionToggleIndexStyle() {
-    bool indexStyleToggle = fActionToggleIndexStyle.isChecked();
-    SkListWidget* list = (SkListWidget*) fListWidget.itemDelegate();
-    list->setIndexStyle(indexStyleToggle ? SkListWidget::kOffset_IndexStyle
-                                         : SkListWidget::kIndex_IndexStyle);
-    fListWidget.update();
-}
-
 void SkDebuggerGUI::showDeletes() {
     bool deletesActivated = fActionShowDeletes.isChecked();
     for (int row = 0; row < fListWidget.count(); row++) {
@@ -483,10 +473,6 @@
     fActionBreakpoint.setText("Breakpoints");
     fActionBreakpoint.setCheckable(true);
 
-    fActionToggleIndexStyle.setShortcut(QKeySequence(tr("Ctrl+T")));
-    fActionToggleIndexStyle.setText("Toggle Index Style");
-    fActionToggleIndexStyle.setCheckable(true);
-
     QIcon cancel;
     cancel.addFile(QString::fromUtf8(":/reload.png"), QSize(),
             QIcon::Normal, QIcon::Off);
@@ -704,7 +690,6 @@
     fMenuView.setTitle("View");
     fMenuView.addAction(&fActionBreakpoint);
     fMenuView.addAction(&fActionShowDeletes);
-    fMenuView.addAction(&fActionToggleIndexStyle);
     fMenuView.addAction(&fActionZoomIn);
     fMenuView.addAction(&fActionZoomOut);
 
@@ -787,6 +772,19 @@
 }
 
 void SkDebuggerGUI::setupListWidget() {
+
+    SkASSERT(!strcmp("Save",
+                     SkDrawCommand::GetCommandString(SkDrawCommand::kSave_OpType)));
+    SkASSERT(!strcmp("SaveLayer",
+                     SkDrawCommand::GetCommandString(SkDrawCommand::kSaveLayer_OpType)));
+    SkASSERT(!strcmp("Restore",
+                     SkDrawCommand::GetCommandString(SkDrawCommand::kRestore_OpType)));
+    SkASSERT(!strcmp("BeginCommentGroup",
+                     SkDrawCommand::GetCommandString(SkDrawCommand::kBeginCommentGroup_OpType)));
+    SkASSERT(!strcmp("EndCommentGroup",
+                     SkDrawCommand::GetCommandString(SkDrawCommand::kEndCommentGroup_OpType)));
+
+
     fListWidget.clear();
     int counter = 0;
     int indent = 0;
@@ -805,13 +803,12 @@
         item->setData(Qt::UserRole + 3, indent);
 
         if (0 == strcmp("Save", commandString.c_str()) ||
-            0 == strcmp("Save Layer", commandString.c_str()) ||
+            0 == strcmp("SaveLayer", commandString.c_str()) ||
             0 == strcmp("BeginCommentGroup", commandString.c_str())) {
             indent += 10;
         }
 
         item->setData(Qt::UserRole + 4, -1);
-        item->setData(Qt::UserRole + 5, (int) command->offset());
 
         fListWidget.addItem(item);
     }
diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h
index d6c3f49..6ff4d4d 100644
--- a/debugger/QT/SkDebuggerGUI.h
+++ b/debugger/QT/SkDebuggerGUI.h
@@ -78,11 +78,6 @@
     void actionBreakpoints();
 
     /**
-        Toggles between count and offset style of command indexing in GUI
-     */
-    void actionToggleIndexStyle();
-
-    /**
         Profile the commands
      */
     void actionProfile();
@@ -243,7 +238,6 @@
 
     QAction fActionOpen;
     QAction fActionBreakpoint;
-    QAction fActionToggleIndexStyle;
     QAction fActionProfile;
     QAction fActionCancel;
     QAction fActionClearBreakpoints;
diff --git a/debugger/QT/SkListWidget.cpp b/debugger/QT/SkListWidget.cpp
index b5f9038..a027778 100644
--- a/debugger/QT/SkListWidget.cpp
+++ b/debugger/QT/SkListWidget.cpp
@@ -61,11 +61,7 @@
 
     QString drawCommandText = index.data(Qt::DisplayRole).toString();
     QString drawCommandNumber;
-    if (kIndex_IndexStyle == fIndexStyle) {
-        drawCommandNumber = index.data(Qt::UserRole + 1).toString();
-    } else {
-        drawCommandNumber = index.data(Qt::UserRole + 5).toString();
-    }
+    drawCommandNumber = index.data(Qt::UserRole + 1).toString();
     float time = index.data(Qt::UserRole + 4).toFloat();
     QString drawTime;
     drawTime.setNum(time, 'f', 2);
diff --git a/debugger/QT/SkListWidget.h b/debugger/QT/SkListWidget.h
index d6e797a..4a799a0 100644
--- a/debugger/QT/SkListWidget.h
+++ b/debugger/QT/SkListWidget.h
@@ -19,16 +19,11 @@
  */
 class SkListWidget : public QAbstractItemDelegate {
 public:
-    enum IndexStyle {
-        kIndex_IndexStyle,
-        kOffset_IndexStyle,
-    };
-
     /**
         Constructs the list widget with the specified parent for layout purposes.
         @param parent  The parent container of this widget
      */
-    SkListWidget(QObject* parent = NULL) : fIndexStyle(kIndex_IndexStyle) {}
+    SkListWidget(QObject* parent = NULL) {}
 
     virtual ~SkListWidget() {}
 
@@ -43,14 +38,6 @@
      */
     QSize sizeHint(const QStyleOptionViewItem& option,
                    const QModelIndex& index) const;
-
-
-    void setIndexStyle(IndexStyle indexStyle) {
-        fIndexStyle = indexStyle;
-    }
-
-protected:
-    IndexStyle fIndexStyle;
 };
 
 #endif
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 4b5e03b..b1e906a 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -128,7 +128,6 @@
 }
 
 void SkDebugCanvas::addDrawCommand(SkDrawCommand* command) {
-    command->setOffset(this->getOpID());
     fCommandVector.push(command);
 }
 
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 35dd6fb..8cf16d2 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -255,15 +255,6 @@
      */
     void applyUserTransform(SkCanvas* canvas);
 
-    size_t getOpID() const {
-#if 0
-        if (fPicture) {
-            return fPicture->EXPERIMENTAL_curOpID();
-        }
-#endif
-        return 0;
-    }
-
     void resetClipStackData() { fClipStackData.reset(); fCalledAddStackData = false; }
 
     void addClipStackData(const SkPath& devPath, const SkPath& operand, SkRegion::Op elementOp);
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 38f02d9..d09de78 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -16,7 +16,6 @@
 
 SkDrawCommand::SkDrawCommand(OpType type)
     : fOpType(type)
-    , fOffset(0)
     , fVisible(true) {
 }
 
diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h
index 9e25f4d..760ce52 100644
--- a/src/utils/debugger/SkDrawCommand.h
+++ b/src/utils/debugger/SkDrawCommand.h
@@ -59,9 +59,6 @@
 
     virtual SkString toString() const;
 
-    void setOffset(size_t offset) { fOffset = offset; }
-    size_t offset() const { return fOffset; }
-
     virtual const char* toCString() const {
         return GetCommandString(fOpType);
     }
@@ -106,7 +103,6 @@
 
 private:
     OpType fOpType;
-    size_t fOffset;
     bool   fVisible;
 };