debugger: Update inspector view data consistently while paused

Make all fields of inspector view (details tab, clipstack tab, geometry
view) update the correct info when user selects a draw command. Also
update the info regardless if the painting is paused or not.

Current clip and matrix will not update consistently even after this
patch, as they depend on stateful debug canvas draw (may be fixed
later).

Review URL: https://codereview.chromium.org/835903002
diff --git a/debugger/QT/SkDrawCommandGeometryWidget.cpp b/debugger/QT/SkDrawCommandGeometryWidget.cpp
index 1172e79..03572cf 100644
--- a/debugger/QT/SkDrawCommandGeometryWidget.cpp
+++ b/debugger/QT/SkDrawCommandGeometryWidget.cpp
@@ -13,7 +13,8 @@
 
 SkDrawCommandGeometryWidget::SkDrawCommandGeometryWidget(SkDebugger *debugger)
     : QFrame()
-    , fDebugger(debugger) {
+    , fDebugger(debugger)
+    , fCommandIndex(-1) {
     this->setStyleSheet("QFrame {background-color: black; border: 1px solid #cccccc;}");
 }
 
@@ -65,6 +66,11 @@
     }
 }
 
+void SkDrawCommandGeometryWidget::setDrawCommandIndex(int commandIndex) {
+    fCommandIndex = commandIndex;
+    this->updateImage();
+}
+
 void SkDrawCommandGeometryWidget::updateImage() {
     if (!fSurface) {
         return;
@@ -72,8 +78,9 @@
 
     bool didRender = false;
     const SkTDArray<SkDrawCommand*>& commands = fDebugger->getDrawCommands();
-    if (0 != commands.count()) {
-        SkDrawCommand* command = commands[fDebugger->index()];
+    if (0 != commands.count() && fCommandIndex >= 0) {
+        SkASSERT(commands.count() > fCommandIndex);
+        SkDrawCommand* command = commands[fCommandIndex];
         didRender = command->render(fSurface->getCanvas());
     }
 
@@ -82,5 +89,5 @@
     }
 
     fSurface->getCanvas()->flush();
-    update();
+    this->update();
 }