 Chromium Code Reviews
 Chromium Code Reviews Issue 362773002:
  Rename SkPicturePlayback to SkPictureData  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master
    
  
    Issue 362773002:
  Rename SkPicturePlayback to SkPictureData  (Closed) 
  Base URL: https://skia.googlesource.com/skia.git@master| 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" | 
| 11 #include "SkImageDecoder.h" | 11 #include "SkImageDecoder.h" | 
| 12 #include <QListWidgetItem> | 12 #include <QListWidgetItem> | 
| 13 #include "PictureRenderer.h" | 13 #include "PictureRenderer.h" | 
| 14 #include "SkPictureRecord.h" | 14 #include "SkPictureRecord.h" | 
| 15 #include "SkPicturePlayback.h" | 15 #include "SkPictureData.h" | 
| 16 | 16 | 
| 17 __SK_FORCE_IMAGE_DECODER_LINKING; | 17 __SK_FORCE_IMAGE_DECODER_LINKING; | 
| 18 | 18 | 
| 19 #if defined(SK_BUILD_FOR_WIN32) | 19 #if defined(SK_BUILD_FOR_WIN32) | 
| 20 #include "SysTimer_windows.h" | 20 #include "SysTimer_windows.h" | 
| 21 #elif defined(SK_BUILD_FOR_MAC) | 21 #elif defined(SK_BUILD_FOR_MAC) | 
| 22 #include "SysTimer_mach.h" | 22 #include "SysTimer_mach.h" | 
| 23 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) | 23 #elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) | 
| 24 #include "SysTimer_posix.h" | 24 #include "SysTimer_posix.h" | 
| 25 #else | 25 #else | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 } | 148 } | 
| 149 | 149 | 
| 150 void SkDebuggerGUI::showDeletes() { | 150 void SkDebuggerGUI::showDeletes() { | 
| 151 fDeletesActivated = !fDeletesActivated; | 151 fDeletesActivated = !fDeletesActivated; | 
| 152 for (int row = 0; row < fListWidget.count(); row++) { | 152 for (int row = 0; row < fListWidget.count(); row++) { | 
| 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 SkPictureData'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 SkPictureData { | 
| 
mtklein
2014/07/01 14:19:49
I take it that future CL will make this sort of th
 
robertphillips
2014/07/01 14:22:09
Yep. It is a bit weird now but this will (hopefull
 | |
| 162 public: | 162 public: | 
| 163 static SkTimedPicturePlayback* CreateFromStream(SkStream* stream, const SkPi ctInfo& info, | 163 static SkTimedPicturePlayback* CreateFromStream(SkStream* stream, const SkPi ctInfo& info, | 
| 164 SkPicture::InstallPixelRefPr oc proc, | 164 SkPicture::InstallPixelRefPr oc proc, | 
| 165 const SkTDArray<bool>& delet edCommands) { | 165 const SkTDArray<bool>& delet edCommands) { | 
| 166 // Mimics SkPicturePlayback::CreateFromStream | 166 // Mimics SkPictureData::CreateFromStream | 
| 167 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback, | 167 SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicture Playback, | 
| 168 (deletedCommands, info))); | 168 (deletedCommands, info))); | 
| 169 if (!playback->parseStream(stream, proc)) { | 169 if (!playback->parseStream(stream, proc)) { | 
| 170 return NULL; // we're invalid | 170 return NULL; // we're invalid | 
| 171 } | 171 } | 
| 172 return playback.detach(); | 172 return playback.detach(); | 
| 173 } | 173 } | 
| 174 | 174 | 
| 175 SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands, | 175 SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands, | 
| 176 const SkPictInfo& info) | 176 const SkPictInfo& info) | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 SkASSERT(opIndex == fCurCommand); | 249 SkASSERT(opIndex == fCurCommand); | 
| 250 SkASSERT(fCurType <= LAST_DRAWTYPE_ENUM); | 250 SkASSERT(fCurType <= LAST_DRAWTYPE_ENUM); | 
| 251 | 251 | 
| 252 fTimes[fCurCommand] += time; | 252 fTimes[fCurCommand] += time; | 
| 253 fTypeTimes[fCurType] += time; | 253 fTypeTimes[fCurType] += time; | 
| 254 fTot += time; | 254 fTot += time; | 
| 255 } | 255 } | 
| 256 #endif | 256 #endif | 
| 257 | 257 | 
| 258 private: | 258 private: | 
| 259 typedef SkPicturePlayback INHERITED; | 259 typedef SkPictureData INHERITED; | 
| 260 }; | 260 }; | 
| 261 | 261 | 
| 262 // Wrap SkPicture to allow installation of an SkTimedPicturePlayback object | 262 // Wrap SkPicture to allow installation of an SkTimedPicturePlayback object | 
| 263 class SkTimedPicture : public SkPicture { | 263 class SkTimedPicture : public SkPicture { | 
| 264 public: | 264 public: | 
| 265 static SkTimedPicture* CreateTimedPicture(SkStream* stream, | 265 static SkTimedPicture* CreateTimedPicture(SkStream* stream, | 
| 266 SkPicture::InstallPixelRefProc pro c, | 266 SkPicture::InstallPixelRefProc pro c, | 
| 267 const SkTDArray<bool>& deletedComm ands) { | 267 const SkTDArray<bool>& deletedComm ands) { | 
| 268 SkPictInfo info; | 268 SkPictInfo info; | 
| 269 if (!InternalOnly_StreamIsSKP(stream, &info)) { | 269 if (!InternalOnly_StreamIsSKP(stream, &info)) { | 
| 270 return NULL; | 270 return NULL; | 
| 271 } | 271 } | 
| 272 | 272 | 
| 273 // Check to see if there is a playback to recreate. | 273 // Check to see if there is a playback to recreate. | 
| 274 if (stream->readBool()) { | 274 if (stream->readBool()) { | 
| 275 SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFro mStream( | 275 SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFro mStream( | 
| 276 stream, | 276 stream, | 
| 277 info, proc, | 277 info, proc, | 
| 278 deletedCommands) ; | 278 deletedCommands) ; | 
| 279 if (NULL == playback) { | 279 if (NULL == playback) { | 
| 280 return NULL; | 280 return NULL; | 
| 281 } | 281 } | 
| 282 | 282 | 
| 283 return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeig ht)); | 283 return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeig ht)); | 
| 284 } | 284 } | 
| 285 | 285 | 
| 286 return NULL; | 286 return NULL; | 
| 287 } | 287 } | 
| 288 | 288 | 
| 289 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback.get())->resetTimes( ); } | 289 void resetTimes() { ((SkTimedPicturePlayback*) fData.get())->resetTimes(); } | 
| 290 | 290 | 
| 291 int count() const { return ((SkTimedPicturePlayback*) fPlayback.get())->coun t(); } | 291 int count() const { return ((SkTimedPicturePlayback*) fData.get())->count(); } | 
| 292 | 292 | 
| 293 // return the fraction of the total time this command consumed | 293 // return the fraction of the total time this command consumed | 
| 294 double time(int index) const { return ((SkTimedPicturePlayback*) fPlayback.g et())->time(index); } | 294 double time(int index) const { return ((SkTimedPicturePlayback*) fData.get() )->time(index); } | 
| 295 | 295 | 
| 296 const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback *) fPlayback.get())->typeTimes(); } | 296 const SkTDArray<double>* typeTimes() const { return ((SkTimedPicturePlayback *) fData.get())->typeTimes(); } | 
| 297 | 297 | 
| 298 double totTime() const { return ((SkTimedPicturePlayback*) fPlayback.get())- >totTime(); } | 298 double totTime() const { return ((SkTimedPicturePlayback*) fData.get())->tot Time(); } | 
| 299 | 299 | 
| 300 private: | 300 private: | 
| 301 // disallow default ctor b.c. we don't have a good way to setup the fPlaybac k ptr | 301 // disallow default ctor b.c. we don't have a good way to setup the fData pt r | 
| 302 SkTimedPicture(); | 302 SkTimedPicture(); | 
| 303 // Private ctor only used by CreateTimedPicture, which has created the playb ack. | 303 // Private ctor only used by CreateTimedPicture, which has created the playb ack. | 
| 304 SkTimedPicture(SkTimedPicturePlayback* playback, int width, int height) | 304 SkTimedPicture(SkTimedPicturePlayback* playback, int width, int height) | 
| 305 : INHERITED(playback, width, height) {} | 305 : INHERITED(playback, width, height) {} | 
| 306 // disallow the copy ctor - enabling would require copying code from SkPictu re | 306 // disallow the copy ctor - enabling would require copying code from SkPictu re | 
| 307 SkTimedPicture(const SkTimedPicture& src); | 307 SkTimedPicture(const SkTimedPicture& src); | 
| 308 | 308 | 
| 309 typedef SkPicture INHERITED; | 309 typedef SkPicture INHERITED; | 
| 310 }; | 310 }; | 
| 311 | 311 | 
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 } | 1069 } | 
| 1070 | 1070 | 
| 1071 // NOTE(chudy): Makes first item unselectable. | 1071 // NOTE(chudy): Makes first item unselectable. | 
| 1072 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( | 1072 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( | 
| 1073 fFilter.model()); | 1073 fFilter.model()); | 
| 1074 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), | 1074 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), | 
| 1075 fFilter.rootModelIndex()); | 1075 fFilter.rootModelIndex()); | 
| 1076 QStandardItem* firstItem = model->itemFromIndex(firstIndex); | 1076 QStandardItem* firstItem = model->itemFromIndex(firstIndex); | 
| 1077 firstItem->setSelectable(false); | 1077 firstItem->setSelectable(false); | 
| 1078 } | 1078 } | 
| OLD | NEW |