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

Side by Side Diff: samplecode/SampleAll.cpp

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rely on RVO in picturerecorder 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 | « include/private/SkMiniRecorder.h ('k') | samplecode/SampleApp.cpp » ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 canvas->save(); 298 canvas->save();
299 this->drawPicture(canvas, 0); 299 this->drawPicture(canvas, 0);
300 canvas->restore(); 300 canvas->restore();
301 301
302 { 302 {
303 SkPictureRecorder recorder; 303 SkPictureRecorder recorder;
304 { 304 {
305 SkCanvas* record = recorder.beginRecording(320, 480, nullptr, 0) ; 305 SkCanvas* record = recorder.beginRecording(320, 480, nullptr, 0) ;
306 this->drawPicture(record, 120); 306 this->drawPicture(record, 120);
307 } 307 }
308 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 308 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
309 309
310 canvas->translate(0, SkIntToScalar(120)); 310 canvas->translate(0, SkIntToScalar(120));
311 311
312 SkRect clip; 312 SkRect clip;
313 clip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160)); 313 clip.set(0, 0, SkIntToScalar(160), SkIntToScalar(160));
314 do { 314 do {
315 canvas->save(); 315 canvas->save();
316 canvas->clipRect(clip); 316 canvas->clipRect(clip);
317 picture->playback(canvas); 317 picture->playback(canvas);
318 canvas->restore(); 318 canvas->restore();
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 private: 566 private:
567 SkPoint fClickPt; 567 SkPoint fClickPt;
568 SkBitmap fBug, fTb, fTx; 568 SkBitmap fBug, fTb, fTx;
569 typedef SampleView INHERITED; 569 typedef SampleView INHERITED;
570 }; 570 };
571 571
572 ////////////////////////////////////////////////////////////////////////////// 572 //////////////////////////////////////////////////////////////////////////////
573 573
574 static SkView* MyFactory() { return new DemoView; } 574 static SkView* MyFactory() { return new DemoView; }
575 static SkViewRegister reg(MyFactory); 575 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/private/SkMiniRecorder.h ('k') | samplecode/SampleApp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698