aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-01-07 07:33:46 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-07 07:33:47 -0800
commit0cfeaf3ac1e7edcf3b618c9f33f4b4bc30321324 (patch)
tree38ba7eb39dd3e6f790c2fb20d63ad5c2afb38d64 /debugger
parent1f611d6d844e799a4ec4aa77060bbb028ac525e4 (diff)
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
Diffstat (limited to 'debugger')
-rw-r--r--debugger/QT/SkDebuggerGUI.cpp75
-rw-r--r--debugger/QT/SkDebuggerGUI.h9
-rw-r--r--debugger/QT/SkDrawCommandGeometryWidget.cpp15
-rw-r--r--debugger/QT/SkDrawCommandGeometryWidget.h9
4 files changed, 57 insertions, 51 deletions
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index 1b5a366aa4..dade56768d 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -66,7 +66,8 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
{
setupUi(this);
fListWidget.setSelectionMode(QAbstractItemView::ExtendedSelection);
- connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(registerListClick(QListWidgetItem *)));
+ connect(&fListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this,
+ SLOT(updateDrawCommandInfo()));
connect(&fActionOpen, SIGNAL(triggered()), this, SLOT(openFile()));
connect(&fActionDirectory, SIGNAL(triggered()), this, SLOT(toggleDirectory()));
connect(&fDirectoryWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(loadFile(QListWidgetItem *)));
@@ -98,8 +99,6 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(int)));
connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int)));
connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(actionScale(float)));
- connect(&fCanvasWidget, SIGNAL(commandChanged(int)), this, SLOT(updateCommand(int)));
- connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fDrawCommandGeometryWidget, SLOT(updateImage()));
connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs()));
connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave()));
@@ -404,33 +403,44 @@ void SkDebuggerGUI::pauseDrawing(bool isPaused) {
}
}
-void SkDebuggerGUI::registerListClick(QListWidgetItem *item) {
- if(!fLoading) {
- int currentRow = fListWidget.currentRow();
-
- if (currentRow != -1) {
- if (!this->isPaused()) {
- fCanvasWidget.drawTo(currentRow);
- }
- const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(currentRow);
-
- /* TODO(chudy): Add command type before parameters. Rename v
- * to something more informative. */
- if (currInfo) {
- QString info;
- info.append("<b>Parameters: </b><br/>");
- for (int i = 0; i < currInfo->count(); i++) {
-
- info.append(QString((*currInfo)[i]->c_str()));
- info.append("<br/>");
- }
- fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabType);
- fInspectorWidget.setDisabled(false);
- fViewStateFrame.setDisabled(false);
+void SkDebuggerGUI::updateDrawCommandInfo() {
+ int currentRow = -1;
+ if (!fLoading) {
+ currentRow = fListWidget.currentRow();
+ }
+ if (currentRow == -1) {
+ fInspectorWidget.setText("", SkInspectorWidget::kDetail_TabType);
+ fInspectorWidget.setText("", SkInspectorWidget::kClipStack_TabType);
+ fCurrentCommandBox.setText("");
+ fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
+ } else {
+ if (!this->isPaused()) {
+ fCanvasWidget.drawTo(currentRow);
+ }
+ const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(currentRow);
+
+ /* TODO(chudy): Add command type before parameters. Rename v
+ * to something more informative. */
+ if (currInfo) {
+ QString info;
+ info.append("<b>Parameters: </b><br/>");
+ for (int i = 0; i < currInfo->count(); i++) {
+ info.append(QString((*currInfo)[i]->c_str()));
+ info.append("<br/>");
}
- setupClipStackText();
+ fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabType);
}
+ SkString clipStack;
+ fDebugger.getClipStackText(&clipStack);
+ fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStack_TabType);
+
+ fCurrentCommandBox.setText(QString::number(currentRow));
+
+ fDrawCommandGeometryWidget.setDrawCommandIndex(currentRow);
+
+ fInspectorWidget.setDisabled(false);
+ fViewStateFrame.setDisabled(false);
}
}
@@ -783,6 +793,8 @@ void SkDebuggerGUI::loadPicture(const SkString& fileName) {
fActionSave.setDisabled(false);
fActionSaveAs.setDisabled(false);
fActionPause.setChecked(false);
+ fDrawCommandGeometryWidget.setDrawCommandIndex(-1);
+
fLoading = false;
actionPlay();
}
@@ -826,11 +838,6 @@ void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes,
fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabType);
}
-void SkDebuggerGUI::setupClipStackText() {
- SkString clipStack;
- fDebugger.getClipStackText(&clipStack);
- fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStack_TabType);
-}
void SkDebuggerGUI::setupComboBox() {
fFilter.clear();
@@ -855,10 +862,6 @@ void SkDebuggerGUI::setupComboBox() {
firstItem->setSelectable(false);
}
-void SkDebuggerGUI::updateCommand(int newCommand) {
- fCurrentCommandBox.setText(QString::number(newCommand));
-}
-
void SkDebuggerGUI::updateHit(int newHit) {
fCommandHitBox.setText(QString::number(newHit));
}
diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h
index 5c003b000a..8c6865b8ca 100644
--- a/debugger/QT/SkDebuggerGUI.h
+++ b/debugger/QT/SkDebuggerGUI.h
@@ -202,9 +202,9 @@ private slots:
void pauseDrawing(bool isPaused = true);
/**
- Executes draw commands up to the selected command
+ Updates the UI based on the selected command.
*/
- void registerListClick(QListWidgetItem *item);
+ void updateDrawCommandInfo();
/**
Sets the command to active in the list widget.
@@ -232,7 +232,6 @@ private slots:
*/
void toggleFilter(QString string);
- void updateCommand(int newCommand);
void updateHit(int newHit);
private:
QSplitter fCentralSplitter;
@@ -338,10 +337,6 @@ private:
*/
void setupOverviewText(const SkTDArray<double>* typeTimes, double totTime, int numRuns);
- /**
- Fills in the clip stack pane with text
- */
- void setupClipStackText();
/**
Render the supplied picture several times tracking the time consumed
diff --git a/debugger/QT/SkDrawCommandGeometryWidget.cpp b/debugger/QT/SkDrawCommandGeometryWidget.cpp
index 1172e7952d..03572cfdd1 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::paintEvent(QPaintEvent* event) {
}
}
+void SkDrawCommandGeometryWidget::setDrawCommandIndex(int commandIndex) {
+ fCommandIndex = commandIndex;
+ this->updateImage();
+}
+
void SkDrawCommandGeometryWidget::updateImage() {
if (!fSurface) {
return;
@@ -72,8 +78,9 @@ void SkDrawCommandGeometryWidget::updateImage() {
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 @@ void SkDrawCommandGeometryWidget::updateImage() {
}
fSurface->getCanvas()->flush();
- update();
+ this->update();
}
diff --git a/debugger/QT/SkDrawCommandGeometryWidget.h b/debugger/QT/SkDrawCommandGeometryWidget.h
index aa5d10a01a..0bdddd0319 100644
--- a/debugger/QT/SkDrawCommandGeometryWidget.h
+++ b/debugger/QT/SkDrawCommandGeometryWidget.h
@@ -19,17 +19,18 @@ class SkDrawCommandGeometryWidget : public QFrame {
public:
SkDrawCommandGeometryWidget(SkDebugger* debugger);
-
-public slots:
- void updateImage();
+ void setDrawCommandIndex(int index);
protected:
void paintEvent(QPaintEvent* event);
void resizeEvent(QResizeEvent* event);
private:
+ void updateImage();
+
SkDebugger* fDebugger;
- SkAutoTUnref<SkSurface> fSurface;
+ SkAutoTUnref<SkSurface> fSurface;
+ int fCommandIndex;
};
#endif /* SKDRAWCOMMANDGEOMETRYWIDGET_H_ */