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

Side by Side Diff: tests/SkResourceCacheTest.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 | « tests/SerializationTest.cpp ('k') | tests/SkpSkGrTest.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 "Test.h" 8 #include "Test.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 test_discarded_image(reporter, xforms[i], []() { 315 test_discarded_image(reporter, xforms[i], []() {
316 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10 )); 316 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10 ));
317 surface->getCanvas()->clear(SK_ColorCYAN); 317 surface->getCanvas()->clear(SK_ColorCYAN);
318 return surface->makeImageSnapshot(); 318 return surface->makeImageSnapshot();
319 }); 319 });
320 320
321 test_discarded_image(reporter, xforms[i], []() { 321 test_discarded_image(reporter, xforms[i], []() {
322 SkPictureRecorder recorder; 322 SkPictureRecorder recorder;
323 SkCanvas* canvas = recorder.beginRecording(10, 10); 323 SkCanvas* canvas = recorder.beginRecording(10, 10);
324 canvas->clear(SK_ColorCYAN); 324 canvas->clear(SK_ColorCYAN);
325 sk_sp<SkPicture> picture(recorder.endRecording()); 325 return SkImage::MakeFromPicture(recorder.finishRecordingAsPicture(),
326 return SkImage::MakeFromPicture(picture, SkISize::Make(10, 10), null ptr, nullptr); 326 SkISize::Make(10, 10), nullptr, null ptr);
327 }); 327 });
328 } 328 }
329 } 329 }
OLDNEW
« no previous file with comments | « tests/SerializationTest.cpp ('k') | tests/SkpSkGrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698