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 "PictureRenderer.h" | 9 #include "PictureRenderer.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 QListWidgetItem *item = fListWidget.item(row); | 130 QListWidgetItem *item = fListWidget.item(row); |
131 item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated); | 131 item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated); |
132 } | 132 } |
133 } | 133 } |
134 // This is a simplification of PictureBenchmark's run with the addition of | 134 // This is a simplification of PictureBenchmark's run with the addition of |
135 // clearing of the times after the first pass (in resetTimes) | 135 // clearing of the times after the first pass (in resetTimes) |
136 void SkDebuggerGUI::run(const SkPicture* pict, | 136 void SkDebuggerGUI::run(const SkPicture* pict, |
137 sk_tools::PictureRenderer* renderer, | 137 sk_tools::PictureRenderer* renderer, |
138 int repeats) { | 138 int repeats) { |
139 SkASSERT(pict); | 139 SkASSERT(pict); |
140 if (NULL == pict) { | 140 if (nullptr == pict) { |
141 return; | 141 return; |
142 } | 142 } |
143 | 143 |
144 SkASSERT(renderer != NULL); | 144 SkASSERT(renderer != nullptr); |
145 if (NULL == renderer) { | 145 if (nullptr == renderer) { |
146 return; | 146 return; |
147 } | 147 } |
148 | 148 |
149 renderer->init(pict, NULL, NULL, NULL, false, false); | 149 renderer->init(pict, nullptr, nullptr, nullptr, false, false); |
150 | 150 |
151 renderer->setup(); | 151 renderer->setup(); |
152 renderer->render(); | 152 renderer->render(); |
153 renderer->resetState(true); // flush, swapBuffers and Finish | 153 renderer->resetState(true); // flush, swapBuffers and Finish |
154 | 154 |
155 for (int i = 0; i < repeats; ++i) { | 155 for (int i = 0; i < repeats; ++i) { |
156 renderer->setup(); | 156 renderer->setup(); |
157 renderer->render(); | 157 renderer->render(); |
158 renderer->resetState(false); // flush & swapBuffers, but don't Finish | 158 renderer->resetState(false); // flush & swapBuffers, but don't Finish |
159 } | 159 } |
(...skipping 14 matching lines...) Expand all Loading... |
174 | 174 |
175 SkFILEStream inputStream; | 175 SkFILEStream inputStream; |
176 | 176 |
177 inputStream.setPath(fFileName.c_str()); | 177 inputStream.setPath(fFileName.c_str()); |
178 if (!inputStream.isValid()) { | 178 if (!inputStream.isValid()) { |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, | 182 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, |
183 &SkImageDecoder::DecodeMemory)); // , fS
kipCommands)); | 183 &SkImageDecoder::DecodeMemory)); // , fS
kipCommands)); |
184 if (NULL == picture.get()) { | 184 if (nullptr == picture.get()) { |
185 return; | 185 return; |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 void SkDebuggerGUI::actionCancel() { | 189 void SkDebuggerGUI::actionCancel() { |
190 for (int row = 0; row < fListWidget.count(); row++) { | 190 for (int row = 0; row < fListWidget.count(); row++) { |
191 fListWidget.item(row)->setHidden(false); | 191 fListWidget.item(row)->setHidden(false); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 } | 722 } |
723 } | 723 } |
724 | 724 |
725 void SkDebuggerGUI::loadPicture(const SkString& fileName) { | 725 void SkDebuggerGUI::loadPicture(const SkString& fileName) { |
726 fFileName = fileName; | 726 fFileName = fileName; |
727 fLoading = true; | 727 fLoading = true; |
728 SkAutoTDelete<SkStream> stream(new SkFILEStream(fileName.c_str())); | 728 SkAutoTDelete<SkStream> stream(new SkFILEStream(fileName.c_str())); |
729 | 729 |
730 SkPicture* picture = SkPicture::CreateFromStream(stream); | 730 SkPicture* picture = SkPicture::CreateFromStream(stream); |
731 | 731 |
732 if (NULL == picture) { | 732 if (nullptr == picture) { |
733 QMessageBox::critical(this, "Error loading file", "Couldn't read file, s
orry."); | 733 QMessageBox::critical(this, "Error loading file", "Couldn't read file, s
orry."); |
734 return; | 734 return; |
735 } | 735 } |
736 | 736 |
737 fCanvasWidget.resetWidgetTransform(); | 737 fCanvasWidget.resetWidgetTransform(); |
738 fDebugger.loadPicture(picture); | 738 fDebugger.loadPicture(picture); |
739 | 739 |
740 fSkipCommands.setCount(fDebugger.getSize()); | 740 fSkipCommands.setCount(fDebugger.getSize()); |
741 for (int i = 0; i < fSkipCommands.count(); ++i) { | 741 for (int i = 0; i < fSkipCommands.count(); ++i) { |
742 fSkipCommands[i] = false; | 742 fSkipCommands[i] = false; |
743 } | 743 } |
744 | 744 |
745 SkSafeUnref(picture); | 745 SkSafeUnref(picture); |
746 | 746 |
747 fActionProfile.setDisabled(false); | 747 fActionProfile.setDisabled(false); |
748 | 748 |
749 /* fDebugCanvas is reinitialized every load picture. Need it to retain value | 749 /* fDebugCanvas is reinitialized every load picture. Need it to retain value |
750 * of the visibility filter. | 750 * of the visibility filter. |
751 * TODO(chudy): This should be deprecated since fDebugger is not | 751 * TODO(chudy): This should be deprecated since fDebugger is not |
752 * recreated. | 752 * recreated. |
753 * */ | 753 * */ |
754 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled(
)); | 754 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled(
)); |
755 | 755 |
756 this->setupListWidget(); | 756 this->setupListWidget(); |
757 this->setupComboBox(); | 757 this->setupComboBox(); |
758 this->setupOverviewText(NULL, 0.0, 1); | 758 this->setupOverviewText(nullptr, 0.0, 1); |
759 fInspectorWidget.setDisabled(false); | 759 fInspectorWidget.setDisabled(false); |
760 fViewStateFrame.setDisabled(false); | 760 fViewStateFrame.setDisabled(false); |
761 fSettingsWidget.setDisabled(false); | 761 fSettingsWidget.setDisabled(false); |
762 fMenuEdit.setDisabled(false); | 762 fMenuEdit.setDisabled(false); |
763 fMenuNavigate.setDisabled(false); | 763 fMenuNavigate.setDisabled(false); |
764 fMenuView.setDisabled(false); | 764 fMenuView.setDisabled(false); |
765 fActionSave.setDisabled(false); | 765 fActionSave.setDisabled(false); |
766 fActionSaveAs.setDisabled(false); | 766 fActionSaveAs.setDisabled(false); |
767 fActionPause.setChecked(false); | 767 fActionPause.setChecked(false); |
768 fDrawCommandGeometryWidget.setDrawCommandIndex(-1); | 768 fDrawCommandGeometryWidget.setDrawCommandIndex(-1); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 fCanvasWidget.drawTo(fPausedRow); | 850 fCanvasWidget.drawTo(fPausedRow); |
851 } else { | 851 } else { |
852 fCanvasWidget.drawTo(fListWidget.currentRow()); | 852 fCanvasWidget.drawTo(fListWidget.currentRow()); |
853 } | 853 } |
854 } | 854 } |
855 | 855 |
856 void SkDebuggerGUI::updateHit(int newHit) { | 856 void SkDebuggerGUI::updateHit(int newHit) { |
857 fCommandHitBox.setText(QString::number(newHit)); | 857 fCommandHitBox.setText(QString::number(newHit)); |
858 } | 858 } |
859 | 859 |
OLD | NEW |