OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkDebuggerGUI.h" | 8 #include "SkDebuggerGUI.h" |
9 #include "SkForceLinking.h" | 9 #include "SkForceLinking.h" |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDel
etes())); | 94 connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDel
etes())); |
95 connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); | 95 connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose())); |
96 connect(&fSettingsWidget, SIGNAL(visibilityFilterChanged()), this, SLOT(acti
onCommandFilter())); | 96 connect(&fSettingsWidget, SIGNAL(visibilityFilterChanged()), this, SLOT(acti
onCommandFilter())); |
97 #if SK_SUPPORT_GPU | 97 #if SK_SUPPORT_GPU |
98 connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLWi
dget())); | 98 connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLWi
dget())); |
99 #endif | 99 #endif |
100 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act
ionTextureFilter())); | 100 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act
ionTextureFilter())); |
101 connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SL
OT(actionRasterWidget(bool))); | 101 connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SL
OT(actionRasterWidget(bool))); |
102 connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), thi
s, SLOT(actionOverdrawVizWidget(bool))); | 102 connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), thi
s, SLOT(actionOverdrawVizWidget(bool))); |
103 connect(fSettingsWidget.getMegaVizCheckBox(), SIGNAL(toggled(bool)), this, S
LOT(actionMegaVizWidget(bool))); | 103 connect(fSettingsWidget.getMegaVizCheckBox(), SIGNAL(toggled(bool)), this, S
LOT(actionMegaVizWidget(bool))); |
| 104 connect(fSettingsWidget.getPathOpsCheckBox(), SIGNAL(toggled(bool)), this, S
LOT(actionPathOpsWidget(bool))); |
104 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))
); | 105 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))
); |
105 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea
kpoint())); | 106 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea
kpoint())); |
106 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes()))
; | 107 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes()))
; |
107 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in
t))); | 108 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in
t))); |
108 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), &fSettingsWidget, SLOT(upda
teHit(int))); | 109 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), &fSettingsWidget, SLOT(upda
teHit(int))); |
109 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action
Scale(float))); | 110 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action
Scale(float))); |
110 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fSettingsWidget, SLOT(
updateCommand(int))); | 111 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fSettingsWidget, SLOT(
updateCommand(int))); |
111 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); | 112 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); |
112 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); | 113 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); |
113 | 114 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // extract the individual command times from the SkTimedPlaybackPicture | 409 // extract the individual command times from the SkTimedPlaybackPicture |
409 for (int i = 0; i < picture->count(); ++i) { | 410 for (int i = 0; i < picture->count(); ++i) { |
410 double temp = picture->time(i); | 411 double temp = picture->time(i); |
411 | 412 |
412 QListWidgetItem* item = fListWidget.item(i); | 413 QListWidgetItem* item = fListWidget.item(i); |
413 | 414 |
414 item->setData(Qt::UserRole + 4, 100.0*temp); | 415 item->setData(Qt::UserRole + 4, 100.0*temp); |
415 } | 416 } |
416 | 417 |
417 setupOverviewText(picture->typeTimes(), picture->totTime(), kNumRepeats); | 418 setupOverviewText(picture->typeTimes(), picture->totTime(), kNumRepeats); |
| 419 setupClipStackText(); |
418 } | 420 } |
419 | 421 |
420 void SkDebuggerGUI::actionCancel() { | 422 void SkDebuggerGUI::actionCancel() { |
421 for (int row = 0; row < fListWidget.count(); row++) { | 423 for (int row = 0; row < fListWidget.count(); row++) { |
422 fListWidget.item(row)->setHidden(false); | 424 fListWidget.item(row)->setHidden(false); |
423 } | 425 } |
424 } | 426 } |
425 | 427 |
426 void SkDebuggerGUI::actionClearBreakpoints() { | 428 void SkDebuggerGUI::actionClearBreakpoints() { |
427 for (int row = 0; row < fListWidget.count(); row++) { | 429 for (int row = 0; row < fListWidget.count(); row++) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 void SkDebuggerGUI::actionOverdrawVizWidget(bool isToggled) { | 530 void SkDebuggerGUI::actionOverdrawVizWidget(bool isToggled) { |
529 fDebugger.setOverdrawViz(isToggled); | 531 fDebugger.setOverdrawViz(isToggled); |
530 fCanvasWidget.update(); | 532 fCanvasWidget.update(); |
531 } | 533 } |
532 | 534 |
533 void SkDebuggerGUI::actionMegaVizWidget(bool isToggled) { | 535 void SkDebuggerGUI::actionMegaVizWidget(bool isToggled) { |
534 fDebugger.setMegaViz(isToggled); | 536 fDebugger.setMegaViz(isToggled); |
535 fCanvasWidget.update(); | 537 fCanvasWidget.update(); |
536 } | 538 } |
537 | 539 |
| 540 void SkDebuggerGUI::actionPathOpsWidget(bool isToggled) { |
| 541 fDebugger.setPathOps(isToggled); |
| 542 fCanvasWidget.update(); |
| 543 } |
| 544 |
538 void SkDebuggerGUI::actionTextureFilter() { | 545 void SkDebuggerGUI::actionTextureFilter() { |
539 SkPaint::FilterLevel level; | 546 SkPaint::FilterLevel level; |
540 bool enabled = fSettingsWidget.getFilterOverride(&level); | 547 bool enabled = fSettingsWidget.getFilterOverride(&level); |
541 fDebugger.setTexFilterOverride(enabled, level); | 548 fDebugger.setTexFilterOverride(enabled, level); |
542 fCanvasWidget.update(); | 549 fCanvasWidget.update(); |
543 } | 550 } |
544 | 551 |
545 void SkDebuggerGUI::actionRewind() { | 552 void SkDebuggerGUI::actionRewind() { |
546 fListWidget.setCurrentRow(0); | 553 fListWidget.setCurrentRow(0); |
547 } | 554 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 QString info; | 662 QString info; |
656 info.append("<b>Parameters: </b><br/>"); | 663 info.append("<b>Parameters: </b><br/>"); |
657 for (int i = 0; i < currInfo->count(); i++) { | 664 for (int i = 0; i < currInfo->count(); i++) { |
658 | 665 |
659 info.append(QString((*currInfo)[i]->c_str())); | 666 info.append(QString((*currInfo)[i]->c_str())); |
660 info.append("<br/>"); | 667 info.append("<br/>"); |
661 } | 668 } |
662 fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabTyp
e); | 669 fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabTyp
e); |
663 fInspectorWidget.setDisabled(false); | 670 fInspectorWidget.setDisabled(false); |
664 } | 671 } |
| 672 setupClipStackText(); |
665 } | 673 } |
666 | 674 |
667 } | 675 } |
668 } | 676 } |
669 | 677 |
670 void SkDebuggerGUI::selectCommand(int command) { | 678 void SkDebuggerGUI::selectCommand(int command) { |
671 if (fPause) { | 679 if (fPause) { |
672 fListWidget.setCurrentRow(command); | 680 fListWidget.setCurrentRow(command); |
673 } | 681 } |
674 } | 682 } |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 } | 1044 } |
1037 | 1045 |
1038 void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes, | 1046 void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes, |
1039 double totTime, | 1047 double totTime, |
1040 int numRuns) { | 1048 int numRuns) { |
1041 SkString overview; | 1049 SkString overview; |
1042 fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns); | 1050 fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns); |
1043 fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabT
ype); | 1051 fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabT
ype); |
1044 } | 1052 } |
1045 | 1053 |
| 1054 void SkDebuggerGUI::setupClipStackText() { |
| 1055 SkString clipStack; |
| 1056 fDebugger.getClipStackText(&clipStack); |
| 1057 fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStack_Ta
bType); |
| 1058 } |
| 1059 |
1046 void SkDebuggerGUI::setupComboBox(SkTArray<SkString>* command) { | 1060 void SkDebuggerGUI::setupComboBox(SkTArray<SkString>* command) { |
1047 fFilter.clear(); | 1061 fFilter.clear(); |
1048 fFilter.addItem("--Filter By Available Commands--"); | 1062 fFilter.addItem("--Filter By Available Commands--"); |
1049 | 1063 |
1050 std::map<std::string, int> map; | 1064 std::map<std::string, int> map; |
1051 for (int i = 0; i < command->count(); i++) { | 1065 for (int i = 0; i < command->count(); i++) { |
1052 map[(*command)[i].c_str()]++; | 1066 map[(*command)[i].c_str()]++; |
1053 } | 1067 } |
1054 | 1068 |
1055 for (std::map<std::string, int>::iterator it = map.begin(); it != map.end(); | 1069 for (std::map<std::string, int>::iterator it = map.begin(); it != map.end(); |
1056 ++it) { | 1070 ++it) { |
1057 fFilter.addItem((it->first).c_str()); | 1071 fFilter.addItem((it->first).c_str()); |
1058 } | 1072 } |
1059 | 1073 |
1060 // NOTE(chudy): Makes first item unselectable. | 1074 // NOTE(chudy): Makes first item unselectable. |
1061 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( | 1075 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( |
1062 fFilter.model()); | 1076 fFilter.model()); |
1063 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), | 1077 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), |
1064 fFilter.rootModelIndex()); | 1078 fFilter.rootModelIndex()); |
1065 QStandardItem* firstItem = model->itemFromIndex(firstIndex); | 1079 QStandardItem* firstItem = model->itemFromIndex(firstIndex); |
1066 firstItem->setSelectable(false); | 1080 firstItem->setSelectable(false); |
1067 } | 1081 } |
OLD | NEW |