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

Side by Side Diff: tests/PictureShaderTest.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/PictureBBHTest.cpp ('k') | tests/PictureTest.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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPicture.h" 9 #include "SkPicture.h"
10 #include "SkPictureRecorder.h" 10 #include "SkPictureRecorder.h"
(...skipping 13 matching lines...) Expand all
24 24
25 paint.setShader(SkShader::MakePictureShader( 25 paint.setShader(SkShader::MakePictureShader(
26 nullptr, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullp tr, nullptr)); 26 nullptr, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullp tr, nullptr));
27 27
28 canvas.drawRect(SkRect::MakeWH(1,1), paint); 28 canvas.drawRect(SkRect::MakeWH(1,1), paint);
29 REPORTER_ASSERT(reporter, *bitmap.getAddr32(0,0) == SK_ColorGREEN); 29 REPORTER_ASSERT(reporter, *bitmap.getAddr32(0,0) == SK_ColorGREEN);
30 30
31 31
32 SkPictureRecorder factory; 32 SkPictureRecorder factory;
33 factory.beginRecording(0, 0, nullptr, 0); 33 factory.beginRecording(0, 0, nullptr, 0);
34 sk_sp<SkPicture> picture(factory.endRecording()); 34 paint.setShader(SkShader::MakePictureShader(factory.finishRecordingAsPicture (),
35 paint.setShader(SkShader::MakePictureShader(std::move(picture), SkShader::kC lamp_TileMode, 35 SkShader::kClamp_TileMode,
36 SkShader::kClamp_TileMode, nullp tr, nullptr)); 36 SkShader::kClamp_TileMode, nullp tr, nullptr));
37 37
38 canvas.drawRect(SkRect::MakeWH(1,1), paint); 38 canvas.drawRect(SkRect::MakeWH(1,1), paint);
39 REPORTER_ASSERT(reporter, *bitmap.getAddr32(0,0) == SK_ColorGREEN); 39 REPORTER_ASSERT(reporter, *bitmap.getAddr32(0,0) == SK_ColorGREEN);
40 } 40 }
OLDNEW
« no previous file with comments | « tests/PictureBBHTest.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698