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

Side by Side Diff: gm/filterfastbounds.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 | « gm/distantclip.cpp ('k') | gm/image.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "gm.h" 8 #include "gm.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkDropShadowImageFilter.h" 10 #include "SkDropShadowImageFilter.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 SkPaint blackFill; 240 SkPaint blackFill;
241 241
242 //----------- 242 //-----------
243 // Normal paints (no source) 243 // Normal paints (no source)
244 SkTArray<SkPaint> paints; 244 SkTArray<SkPaint> paints;
245 create_paints(nullptr, &paints); 245 create_paints(nullptr, &paints);
246 246
247 //----------- 247 //-----------
248 // Paints with a PictureImageFilter as a source 248 // Paints with a PictureImageFilter as a source
249 SkAutoTUnref<SkPicture> pic; 249 sk_sp<SkPicture> pic;
250 250
251 { 251 {
252 SkPictureRecorder rec; 252 SkPictureRecorder rec;
253 253
254 SkCanvas* c = rec.beginRecording(10, 10); 254 SkCanvas* c = rec.beginRecording(10, 10);
255 c->drawRect(SkRect::MakeWH(10, 10), blackFill); 255 c->drawRect(SkRect::MakeWH(10, 10), blackFill);
256 pic.reset(rec.endRecording()); 256 pic = rec.finishRecordingAsPicture();
257 } 257 }
258 258
259 SkAutoTUnref<SkImageFilter> pif(SkPictureImageFilter::Create(pic)); 259 SkAutoTUnref<SkImageFilter> pif(SkPictureImageFilter::Create(pic.get())) ;
260 260
261 SkTArray<SkPaint> pifPaints; 261 SkTArray<SkPaint> pifPaints;
262 create_paints(pif, &pifPaints); 262 create_paints(pif, &pifPaints);
263 263
264 //----------- 264 //-----------
265 // Paints with a SkImageSource as a source 265 // Paints with a SkImageSource as a source
266 266
267 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); 267 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
268 { 268 {
269 SkPaint p; 269 SkPaint p;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 328
329 private: 329 private:
330 typedef GM INHERITED; 330 typedef GM INHERITED;
331 }; 331 };
332 332
333 ////////////////////////////////////////////////////////////////////////////// 333 //////////////////////////////////////////////////////////////////////////////
334 334
335 DEF_GM(return new ImageFilterFastBoundGM;) 335 DEF_GM(return new ImageFilterFastBoundGM;)
336 } 336 }
OLDNEW
« no previous file with comments | « gm/distantclip.cpp ('k') | gm/image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698