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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 QListWidgetItem *item = fListWidget.item(row); | 153 QListWidgetItem *item = fListWidget.item(row); |
154 item->setHidden(fDebugger.isCommandVisible(row) && fDeletesActivated); | 154 item->setHidden(fDebugger.isCommandVisible(row) && fDeletesActivated); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 // The timed picture playback uses the SkPicturePlayback's profiling stubs | 158 // The timed picture playback uses the SkPicturePlayback's profiling stubs |
159 // to time individual commands. The offsets are needed to map SkPicture | 159 // to time individual commands. The offsets are needed to map SkPicture |
160 // offsets to individual commands. | 160 // offsets to individual commands. |
161 class SkTimedPicturePlayback : public SkPicturePlayback { | 161 class SkTimedPicturePlayback : public SkPicturePlayback { |
162 public: | 162 public: |
163 static SkTimedPicturePlayback* CreateFromStream(SkPicture* picture, | 163 static SkTimedPicturePlayback* CreateFromStream(SkStream* stream, const SkPi ctInfo& info, |
164 SkStream* stream, const SkPi ctInfo& info, | |
165 SkPicture::InstallPixelRefPr oc proc, | 164 SkPicture::InstallPixelRefPr oc proc, |
166 const SkTDArray<bool>& delet edCommands) { | 165 const SkTDArray<bool>& delet edCommands) { |
167 // Mimics SkPicturePlayback::CreateFromStream | 166 // Mimics SkPicturePlayback::CreateFromStream |
168 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback, | 167 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback, |
169 (picture, deleted Commands, info))); | 168 (deletedCommands, info))); |
170 if (!playback->parseStream(picture, stream, proc)) { | 169 if (!playback->parseStream(stream, proc)) { |
171 return NULL; // we're invalid | 170 return NULL; // we're invalid |
172 } | 171 } |
173 return playback.detach(); | 172 return playback.detach(); |
174 } | 173 } |
175 | 174 |
176 SkTimedPicturePlayback(SkPicture* picture, | 175 SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands, |
177 const SkTDArray<bool>& deletedCommands, | |
178 const SkPictInfo& info) | 176 const SkPictInfo& info) |
179 : INHERITED(picture, info) | 177 : INHERITED(info) |
180 , fSkipCommands(deletedCommands) | 178 , fSkipCommands(deletedCommands) |
181 , fTot(0.0) | 179 , fTot(0.0) |
182 , fCurCommand(0) { | 180 , fCurCommand(0) { |
183 fTimes.setCount(deletedCommands.count()); | 181 fTimes.setCount(deletedCommands.count()); |
184 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1); | 182 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1); |
185 this->resetTimes(); | 183 this->resetTimes(); |
186 } | 184 } |
187 | 185 |
188 void resetTimes() { | 186 void resetTimes() { |
189 for (int i = 0; i < fTimes.count(); ++i) { | 187 for (int i = 0; i < fTimes.count(); ++i) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 class SkTimedPicture : public SkPicture { | 263 class SkTimedPicture : public SkPicture { |
266 public: | 264 public: |
267 static SkTimedPicture* CreateTimedPicture(SkStream* stream, | 265 static SkTimedPicture* CreateTimedPicture(SkStream* stream, |
268 SkPicture::InstallPixelRefProc pro c, | 266 SkPicture::InstallPixelRefProc pro c, |
269 const SkTDArray<bool>& deletedComm ands) { | 267 const SkTDArray<bool>& deletedComm ands) { |
270 SkPictInfo info; | 268 SkPictInfo info; |
271 if (!InternalOnly_StreamIsSKP(stream, &info)) { | 269 if (!InternalOnly_StreamIsSKP(stream, &info)) { |
272 return NULL; | 270 return NULL; |
273 } | 271 } |
274 | 272 |
275 SkTimedPicture* newPict = SkNEW_ARGS(SkTimedPicture, (NULL, info.fWidth, info.fHeight)); | |
276 // Check to see if there is a playback to recreate. | 273 // Check to see if there is a playback to recreate. |
277 if (stream->readBool()) { | 274 if (stream->readBool()) { |
278 SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFro mStream( | 275 SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFro mStream( |
279 newPict, stream, | 276 stream, |
280 info, proc, | 277 info, proc, |
281 deletedCommands) ; | 278 deletedCommands) ; |
282 if (NULL == playback) { | 279 if (NULL == playback) { |
283 SkDELETE(newPict); | |
284 return NULL; | 280 return NULL; |
285 } | 281 } |
286 newPict->fPlayback = playback; | 282 |
283 return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeig ht)); | |
287 } | 284 } |
288 | 285 |
289 return newPict; | 286 return NULL; |
mtklein
2014/06/11 21:12:58
This used to return a SkTimedPicture(NULL, w, h) i
robertphillips
2014/06/12 12:27:29
My thinking on this is that the caller already has
| |
290 } | 287 } |
291 | 288 |
292 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); } | 289 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); } |
293 | 290 |
294 int count() const { return ((SkTimedPicturePlayback*) fPlayback)->count(); } | 291 int count() const { return ((SkTimedPicturePlayback*) fPlayback)->count(); } |
295 | 292 |
296 // return the fraction of the total time this command consumed | 293 // return the fraction of the total time this command consumed |
297 double time(int index) const { return ((SkTimedPicturePlayback*) fPlayback)- >time(index); } | 294 double time(int index) const { return ((SkTimedPicturePlayback*) fPlayback)- >time(index); } |
298 | 295 |
299 const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback *) fPlayback)->typeTimes(); } | 296 const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback *) fPlayback)->typeTimes(); } |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1072 } | 1069 } |
1073 | 1070 |
1074 // NOTE(chudy): Makes first item unselectable. | 1071 // NOTE(chudy): Makes first item unselectable. |
1075 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( | 1072 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( |
1076 fFilter.model()); | 1073 fFilter.model()); |
1077 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), | 1074 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), |
1078 fFilter.rootModelIndex()); | 1075 fFilter.rootModelIndex()); |
1079 QStandardItem* firstItem = model->itemFromIndex(firstIndex); | 1076 QStandardItem* firstItem = model->itemFromIndex(firstIndex); |
1080 firstItem->setSelectable(false); | 1077 firstItem->setSelectable(false); |
1081 } | 1078 } |
OLD | NEW |