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

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

Issue 24826002: Allow creating a picture from skp to fail. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | src/core/SkPicture.cpp » ('j') | src/core/SkPicturePlayback.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
scroggo 2013/09/26 21:06:28 Patchset 1 reverts r7844: "Remove bogus ability fo
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"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 item->setHidden(fDebugger.isCommandVisible(row) 140 item->setHidden(fDebugger.isCommandVisible(row)
141 && fDeletesActivated); 141 && fDeletesActivated);
142 } 142 }
143 } 143 }
144 144
145 // The timed picture playback uses the SkPicturePlayback's profiling stubs 145 // The timed picture playback uses the SkPicturePlayback's profiling stubs
146 // to time individual commands. The offsets are needed to map SkPicture 146 // to time individual commands. The offsets are needed to map SkPicture
147 // offsets to individual commands. 147 // offsets to individual commands.
148 class SkTimedPicturePlayback : public SkPicturePlayback { 148 class SkTimedPicturePlayback : public SkPicturePlayback {
149 public: 149 public:
150 SkTimedPicturePlayback(SkStream* stream, const SkPictInfo& info, 150 SkTimedPicturePlayback(SkStream* stream, const SkPictInfo& info, bool* isVal id,
151 SkPicture::InstallPixelRefProc proc, 151 SkPicture::InstallPixelRefProc proc,
152 const SkTDArray<bool>& deletedCommands) 152 const SkTDArray<bool>& deletedCommands)
153 : INHERITED(stream, info, proc) 153 : INHERITED(stream, info, isValid, proc)
154 , fSkipCommands(deletedCommands) 154 , fSkipCommands(deletedCommands)
155 , fTot(0.0) 155 , fTot(0.0)
156 , fCurCommand(0) { 156 , fCurCommand(0) {
157 fTimes.setCount(deletedCommands.count()); 157 fTimes.setCount(deletedCommands.count());
158 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1); 158 fTypeTimes.setCount(LAST_DRAWTYPE_ENUM+1);
159 this->resetTimes(); 159 this->resetTimes();
160 } 160 }
161 161
162 void resetTimes() { 162 void resetTimes() {
163 for (int i = 0; i < fTimes.count(); ++i) { 163 for (int i = 0; i < fTimes.count(); ++i) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 SkPicture::InstallPixelRefProc pro c, 242 SkPicture::InstallPixelRefProc pro c,
243 const SkTDArray<bool>& deletedComm ands) { 243 const SkTDArray<bool>& deletedComm ands) {
244 SkPictInfo info; 244 SkPictInfo info;
245 if (!StreamIsSKP(stream, &info)) { 245 if (!StreamIsSKP(stream, &info)) {
246 return NULL; 246 return NULL;
247 } 247 }
248 248
249 SkTimedPicturePlayback* playback; 249 SkTimedPicturePlayback* playback;
250 // Check to see if there is a playback to recreate. 250 // Check to see if there is a playback to recreate.
251 if (stream->readBool()) { 251 if (stream->readBool()) {
252 bool isValid = false;
252 playback = SkNEW_ARGS(SkTimedPicturePlayback, 253 playback = SkNEW_ARGS(SkTimedPicturePlayback,
253 (stream, info, proc, deletedCommands)); 254 (stream, info, &isValid, proc, deletedCommand s));
255 if (!isValid) {
256 SkDELETE(playback);
257 return NULL;
258 }
254 } else { 259 } else {
255 playback = NULL; 260 playback = NULL;
256 } 261 }
257 262
258 return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeight)) ; 263 return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeight)) ;
259 } 264 }
260 265
261 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); } 266 void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); }
262 267
263 int count() const { return ((SkTimedPicturePlayback*) fPlayback)->count(); } 268 int count() const { return ((SkTimedPicturePlayback*) fPlayback)->count(); }
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1012 }
1008 1013
1009 // NOTE(chudy): Makes first item unselectable. 1014 // NOTE(chudy): Makes first item unselectable.
1010 QStandardItemModel* model = qobject_cast<QStandardItemModel*>( 1015 QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
1011 fFilter.model()); 1016 fFilter.model());
1012 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(), 1017 QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
1013 fFilter.rootModelIndex()); 1018 fFilter.rootModelIndex());
1014 QStandardItem* firstItem = model->itemFromIndex(firstIndex); 1019 QStandardItem* firstItem = model->itemFromIndex(firstIndex);
1015 firstItem->setSelectable(false); 1020 firstItem->setSelectable(false);
1016 } 1021 }
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPicture.cpp » ('j') | src/core/SkPicturePlayback.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698