Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: debugger/QT/SkDebuggerGUI.cpp

Issue 249453002: First step in pulling SkPicturePlayback & SkPictureRecord out of SkPicture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: cleanup Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 QListWidgetItem *item = fListWidget.item(row); 152 QListWidgetItem *item = fListWidget.item(row);
153 item->setHidden(fDebugger.isCommandVisible(row) && fDeletesActivated); 153 item->setHidden(fDebugger.isCommandVisible(row) && fDeletesActivated);
154 } 154 }
155 } 155 }
156 156
157 // The timed picture playback uses the SkPicturePlayback's profiling stubs 157 // The timed picture playback uses the SkPicturePlayback's profiling stubs
158 // to time individual commands. The offsets are needed to map SkPicture 158 // to time individual commands. The offsets are needed to map SkPicture
159 // offsets to individual commands. 159 // offsets to individual commands.
160 class SkTimedPicturePlayback : public SkPicturePlayback { 160 class SkTimedPicturePlayback : public SkPicturePlayback {
161 public: 161 public:
162 static SkTimedPicturePlayback* CreateFromStream(SkStream* stream, const SkPi ctInfo& info, 162 static SkTimedPicturePlayback* CreateFromStream(SkPicture* picture,
163 SkStream* stream, const SkPi ctInfo& info,
163 SkPicture::InstallPixelRefPr oc proc, 164 SkPicture::InstallPixelRefPr oc proc,
164 const SkTDArray<bool>& delet edCommands) { 165 const SkTDArray<bool>& delet edCommands) {
165 // Mimics SkPicturePlayback::CreateFromStream 166 // Mimics SkPicturePlayback::CreateFromStream
166 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback, 167 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback,
167 (deletedComman ds, info))); 168 (picture, deleted Commands, info)));
168 if (!playback->parseStream(stream, proc)) { 169 if (!playback->parseStream(picture, stream, proc)) {
169 return NULL; // we're invalid 170 return NULL; // we're invalid
170 } 171 }
171 return playback.detach(); 172 return playback.detach();
172 } 173 }
173 174
174 SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands, const SkPictI nfo& info) 175 SkTimedPicturePlayback(SkPicture* picture,
175 : INHERITED(info) 176 const SkTDArray<bool>& deletedCommands,
177 const SkPictInfo& info)
178 : INHERITED(picture, info)
176 , fSkipCommands(deletedCommands) 179 , fSkipCommands(deletedCommands)
177 , fTot(0.0) 180 , fTot(0.0)
178 , fCurCommand(0) { 181 , fCurCommand(0) {
179 fTimes.setCount(deletedCommands.count()); 182 fTimes.setCount(deletedCommands.count());
180 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1); 183 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1);
181 this->resetTimes(); 184 this->resetTimes();
182 } 185 }
183 186
184 void resetTimes() { 187 void resetTimes() {
185 for (int i = 0; i < fTimes.count(); ++i) { 188 for (int i = 0; i < fTimes.count(); ++i) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 class SkTimedPicture : public SkPicture { 264 class SkTimedPicture : public SkPicture {
262 public: 265 public:
263 static SkTimedPicture* CreateTimedPicture(SkStream* stream, 266 static SkTimedPicture* CreateTimedPicture(SkStream* stream,
264 SkPicture::InstallPixelRefProc pro c, 267 SkPicture::InstallPixelRefProc pro c,
265 const SkTDArray<bool>& deletedComm ands) { 268 const SkTDArray<bool>& deletedComm ands) {
266 SkPictInfo info; 269 SkPictInfo info;
267 if (!InternalOnly_StreamIsSKP(stream, &info)) { 270 if (!InternalOnly_StreamIsSKP(stream, &info)) {
268 return NULL; 271 return NULL;
269 } 272 }
270 273
271 SkTimedPicturePlayback* playback; 274 SkTimedPicture* newPict = SkNEW_ARGS(SkTimedPicture, (NULL, info.fWidth, info.fHeight));
272 // Check to see if there is a playback to recreate. 275 // Check to see if there is a playback to recreate.
273 if (stream->readBool()) { 276 if (stream->readBool()) {
274 playback = SkTimedPicturePlayback::CreateFromStream(stream, info, pr oc, 277 SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFro mStream(
278 newPict, stream,
279 info, proc,
275 deletedCommands) ; 280 deletedCommands) ;
276 if (NULL == playback) { 281 if (NULL == playback) {
282 SkDELETE(newPict);
277 return NULL; 283 return NULL;
278 } 284 }
279 } else { 285 newPict->fPlayback = playback;
280 playback = NULL;
281 } 286 }
282 287
283 return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeight)) ; 288 return newPict;
284 } 289 }
285 290
286 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); } 291 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); }
287 292
288 int count() const { return ((SkTimedPicturePlayback*) fPlayback)->count(); } 293 int count() const { return ((SkTimedPicturePlayback*) fPlayback)->count(); }
289 294
290 // return the fraction of the total time this command consumed 295 // return the fraction of the total time this command consumed
291 double time(int index) const { return ((SkTimedPicturePlayback*) fPlayback)- >time(index); } 296 double time(int index) const { return ((SkTimedPicturePlayback*) fPlayback)- >time(index); }
292 297
293 const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback *) fPlayback)->typeTimes(); } 298 const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback *) fPlayback)->typeTimes(); }
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 } 1058 }
1054 1059
1055 // NOTE(chudy): Makes first item unselectable. 1060 // NOTE(chudy): Makes first item unselectable.
1056 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( 1061 QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
1057 fFilter.model()); 1062 fFilter.model());
1058 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), 1063 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
1059 fFilter.rootModelIndex()); 1064 fFilter.rootModelIndex());
1060 QStandardItem* firstItem = model->itemFromIndex(firstIndex); 1065 QStandardItem* firstItem = model->itemFromIndex(firstIndex);
1061 firstItem->setSelectable(false); 1066 firstItem->setSelectable(false);
1062 } 1067 }
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698