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

Side by Side Diff: samplecode/SamplePictFile.cpp

Issue 1809943005: Fix pessimizing move in SamplePictFile (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | no next file » | 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 2011 Google Inc. 2 * Copyright 2011 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 if (nullptr == pic) { 186 if (nullptr == pic) {
187 return nullptr; 187 return nullptr;
188 } 188 }
189 189
190 SkAutoTDelete<SkBBHFactory> factory; 190 SkAutoTDelete<SkBBHFactory> factory;
191 switch (bbox) { 191 switch (bbox) {
192 case kNo_BBoxType: 192 case kNo_BBoxType:
193 // no bbox playback necessary 193 // no bbox playback necessary
194 return std::move(pic); 194 return pic;
195 case kRTree_BBoxType: 195 case kRTree_BBoxType:
196 factory.reset(new SkRTreeFactory); 196 factory.reset(new SkRTreeFactory);
197 break; 197 break;
198 default: 198 default:
199 SkASSERT(false); 199 SkASSERT(false);
200 } 200 }
201 201
202 SkPictureRecorder recorder; 202 SkPictureRecorder recorder;
203 pic->playback(recorder.beginRecording(pic->cullRect().width(), 203 pic->playback(recorder.beginRecording(pic->cullRect().width(),
204 pic->cullRect().height(), 204 pic->cullRect().height(),
205 factory.get(), 0)); 205 factory.get(), 0));
206 return recorder.finishRecordingAsPicture(); 206 return recorder.finishRecordingAsPicture();
207 } 207 }
208 208
209 typedef SampleView INHERITED; 209 typedef SampleView INHERITED;
210 }; 210 };
211 211
212 SampleView* CreateSamplePictFileView(const char filename[]); 212 SampleView* CreateSamplePictFileView(const char filename[]);
213 SampleView* CreateSamplePictFileView(const char filename[]) { 213 SampleView* CreateSamplePictFileView(const char filename[]) {
214 return new PictFileView(filename); 214 return new PictFileView(filename);
215 } 215 }
216 216
217 ////////////////////////////////////////////////////////////////////////////// 217 //////////////////////////////////////////////////////////////////////////////
218 218
219 #if 0 219 #if 0
220 static SkView* MyFactory() { return new PictFileView; } 220 static SkView* MyFactory() { return new PictFileView; }
221 static SkViewRegister reg(MyFactory); 221 static SkViewRegister reg(MyFactory);
222 #endif 222 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698