OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |