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

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

Issue 214413008: Thread picture version through to SkReadBuffer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: debugger too 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
« no previous file with comments | « no previous file | include/core/SkReadBuffer.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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(SkStream* stream, const SkPi ctInfo& info,
163 SkPicture::InstallPixelRefPr oc proc, 163 SkPicture::InstallPixelRefPr oc proc,
164 const SkTDArray<bool>& delet edCommands) { 164 const SkTDArray<bool>& delet edCommands) {
165 // Mimics SkPicturePlayback::CreateFromStream 165 // Mimics SkPicturePlayback::CreateFromStream
166 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback, 166 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback,
167 (deletedComman ds))); 167 (deletedComman ds, info)));
168 if (!playback->parseStream(stream, info, proc)) { 168 if (!playback->parseStream(stream, proc)) {
169 return NULL; // we're invalid 169 return NULL; // we're invalid
170 } 170 }
171 return playback.detach(); 171 return playback.detach();
172 } 172 }
173 173
174 SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands) 174 SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands, const SkPictI nfo& info)
175 : INHERITED() 175 : INHERITED(info)
176 , fSkipCommands(deletedCommands) 176 , fSkipCommands(deletedCommands)
177 , fTot(0.0) 177 , fTot(0.0)
178 , fCurCommand(0) { 178 , fCurCommand(0) {
179 fTimes.setCount(deletedCommands.count()); 179 fTimes.setCount(deletedCommands.count());
180 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1); 180 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1);
181 this->resetTimes(); 181 this->resetTimes();
182 } 182 }
183 183
184 void resetTimes() { 184 void resetTimes() {
185 for (int i = 0; i < fTimes.count(); ++i) { 185 for (int i = 0; i < fTimes.count(); ++i) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 SkASSERT(opIndex == fCurCommand); 247 SkASSERT(opIndex == fCurCommand);
248 SkASSERT(fCurType <= LAST_DRAWTYPE_ENUM); 248 SkASSERT(fCurType <= LAST_DRAWTYPE_ENUM);
249 249
250 fTimes[fCurCommand] += time; 250 fTimes[fCurCommand] += time;
251 fTypeTimes[fCurType] += time; 251 fTypeTimes[fCurType] += time;
252 fTot += time; 252 fTot += time;
253 } 253 }
254 #endif 254 #endif
255 255
256 private: 256 private:
257 // SkPicturePlayback::parseStream is protected, so it can be
258 // called here, but not by our static factory function. This
259 // allows the factory function to call it.
260 bool parseStream(SkStream* stream, const SkPictInfo& info,
261 SkPicture::InstallPixelRefProc proc) {
262 return this->INHERITED::parseStream(stream, info, proc);
263 }
264
265 typedef SkPicturePlayback INHERITED; 257 typedef SkPicturePlayback INHERITED;
266 }; 258 };
267 259
268 // Wrap SkPicture to allow installation of an SkTimedPicturePlayback object 260 // Wrap SkPicture to allow installation of an SkTimedPicturePlayback object
269 class SkTimedPicture : public SkPicture { 261 class SkTimedPicture : public SkPicture {
270 public: 262 public:
271 static SkTimedPicture* CreateTimedPicture(SkStream* stream, 263 static SkTimedPicture* CreateTimedPicture(SkStream* stream,
272 SkPicture::InstallPixelRefProc pro c, 264 SkPicture::InstallPixelRefProc pro c,
273 const SkTDArray<bool>& deletedComm ands) { 265 const SkTDArray<bool>& deletedComm ands) {
274 SkPictInfo info; 266 SkPictInfo info;
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 } 1053 }
1062 1054
1063 // NOTE(chudy): Makes first item unselectable. 1055 // NOTE(chudy): Makes first item unselectable.
1064 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( 1056 QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
1065 fFilter.model()); 1057 fFilter.model());
1066 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), 1058 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
1067 fFilter.rootModelIndex()); 1059 fFilter.rootModelIndex());
1068 QStandardItem* firstItem = model->itemFromIndex(firstIndex); 1060 QStandardItem* firstItem = model->itemFromIndex(firstIndex);
1069 firstItem->setSelectable(false); 1061 firstItem->setSelectable(false);
1070 } 1062 }
OLDNEW
« no previous file with comments | « no previous file | include/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698