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" | |
10 #include "SkPictureData.h" | 9 #include "SkPictureData.h" |
11 #include "SkPicturePlayback.h" | 10 #include "SkPicturePlayback.h" |
12 #include "SkPictureRecord.h" | 11 #include "SkPictureRecord.h" |
13 #include <QListWidgetItem> | 12 #include <QListWidgetItem> |
14 #include <QtGui> | 13 #include <QtGui> |
15 #include "sk_tool_utils.h" | 14 #include "sk_tool_utils.h" |
16 | 15 |
17 #if defined(SK_BUILD_FOR_WIN32) | |
18 #include "SysTimer_windows.h" | |
19 #elif defined(SK_BUILD_FOR_MAC) | |
20 #include "SysTimer_mach.h" | |
21 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) | |
22 #include "SysTimer_posix.h" | |
23 #else | |
24 #include "SysTimer_c.h" | |
25 #endif | |
26 | |
27 | |
28 SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : | 16 SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : |
29 QMainWindow(parent) | 17 QMainWindow(parent) |
30 , fCentralSplitter(this) | 18 , fCentralSplitter(this) |
31 , fStatusBar(this) | 19 , fStatusBar(this) |
32 , fToolBar(this) | 20 , fToolBar(this) |
33 , fActionOpen(this) | 21 , fActionOpen(this) |
34 , fActionBreakpoint(this) | 22 , fActionBreakpoint(this) |
35 , fActionProfile(this) | 23 , fActionProfile(this) |
36 , fActionCancel(this) | 24 , fActionCancel(this) |
37 , fActionClearBreakpoints(this) | 25 , fActionClearBreakpoints(this) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 } | 112 } |
125 } | 113 } |
126 | 114 |
127 void SkDebuggerGUI::showDeletes() { | 115 void SkDebuggerGUI::showDeletes() { |
128 bool deletesActivated = fActionShowDeletes.isChecked(); | 116 bool deletesActivated = fActionShowDeletes.isChecked(); |
129 for (int row = 0; row < fListWidget.count(); row++) { | 117 for (int row = 0; row < fListWidget.count(); row++) { |
130 QListWidgetItem *item = fListWidget.item(row); | 118 QListWidgetItem *item = fListWidget.item(row); |
131 item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated); | 119 item->setHidden(fDebugger.isCommandVisible(row) && deletesActivated); |
132 } | 120 } |
133 } | 121 } |
134 // This is a simplification of PictureBenchmark's run with the addition of | |
135 // clearing of the times after the first pass (in resetTimes) | |
136 void SkDebuggerGUI::run(const SkPicture* pict, | |
137 sk_tools::PictureRenderer* renderer, | |
138 int repeats) { | |
139 SkASSERT(pict); | |
140 if (nullptr == pict) { | |
141 return; | |
142 } | |
143 | |
144 SkASSERT(renderer != nullptr); | |
145 if (nullptr == renderer) { | |
146 return; | |
147 } | |
148 | |
149 renderer->init(pict, nullptr, nullptr, nullptr, false, false); | |
150 | |
151 renderer->setup(); | |
152 renderer->render(); | |
153 renderer->resetState(true); // flush, swapBuffers and Finish | |
154 | |
155 for (int i = 0; i < repeats; ++i) { | |
156 renderer->setup(); | |
157 renderer->render(); | |
158 renderer->resetState(false); // flush & swapBuffers, but don't Finish | |
159 } | |
160 renderer->resetState(true); // flush, swapBuffers and Finish | |
161 | |
162 renderer->end(); | |
163 } | |
164 | 122 |
165 void SkDebuggerGUI::actionProfile() { | 123 void SkDebuggerGUI::actionProfile() { |
djsollen
2015/10/26 13:17:48
Can we just remove the profiling option altogether
robertphillips
2015/10/26 16:01:07
Done.
| |
166 // In order to profile we pass the command offsets (that were read-in | |
167 // in loadPicture by the SkOffsetPicture) to an SkTimedPlaybackPicture. | |
168 // The SkTimedPlaybackPicture in turn passes the offsets to an | |
169 // SkTimedPicturePlayback object which uses them to track the performance | |
170 // of individual commands. | |
171 if (fFileName.isEmpty()) { | |
172 return; | |
173 } | |
174 | 124 |
175 SkFILEStream inputStream; | |
176 | |
177 inputStream.setPath(fFileName.c_str()); | |
178 if (!inputStream.isValid()) { | |
179 return; | |
180 } | |
181 | |
182 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, | |
183 &SkImageDecoder::DecodeMemory)); // , fS kipCommands)); | |
184 if (nullptr == picture.get()) { | |
185 return; | |
186 } | |
187 } | 125 } |
188 | 126 |
189 void SkDebuggerGUI::actionCancel() { | 127 void SkDebuggerGUI::actionCancel() { |
190 for (int row = 0; row < fListWidget.count(); row++) { | 128 for (int row = 0; row < fListWidget.count(); row++) { |
191 fListWidget.item(row)->setHidden(false); | 129 fListWidget.item(row)->setHidden(false); |
192 } | 130 } |
193 } | 131 } |
194 | 132 |
195 void SkDebuggerGUI::actionClearBreakpoints() { | 133 void SkDebuggerGUI::actionClearBreakpoints() { |
196 for (int row = 0; row < fListWidget.count(); row++) { | 134 for (int row = 0; row < fListWidget.count(); row++) { |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 fCanvasWidget.drawTo(fPausedRow); | 788 fCanvasWidget.drawTo(fPausedRow); |
851 } else { | 789 } else { |
852 fCanvasWidget.drawTo(fListWidget.currentRow()); | 790 fCanvasWidget.drawTo(fListWidget.currentRow()); |
853 } | 791 } |
854 } | 792 } |
855 | 793 |
856 void SkDebuggerGUI::updateHit(int newHit) { | 794 void SkDebuggerGUI::updateHit(int newHit) { |
857 fCommandHitBox.setText(QString::number(newHit)); | 795 fCommandHitBox.setText(QString::number(newHit)); |
858 } | 796 } |
859 | 797 |
OLD | NEW |