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

Unified Diff: samplecode/SampleHairModes.cpp

Issue 1772463002: use Make instead of Create to return a shared shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleGradients.cpp ('k') | samplecode/SampleLayers.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleHairModes.cpp
diff --git a/samplecode/SampleHairModes.cpp b/samplecode/SampleHairModes.cpp
index ae41aa9c9d321f6c53aa6a3e229472586d5a3197..085581cfc958817da68e118b3ad7c6298da670d6 100644
--- a/samplecode/SampleHairModes.cpp
+++ b/samplecode/SampleHairModes.cpp
@@ -60,7 +60,7 @@ static SkScalar drawCell(SkCanvas* canvas, SkXfermode* mode, SkAlpha a0, SkAlpha
return H;
}
-static SkShader* make_bg_shader() {
+static sk_sp<SkShader> make_bg_shader() {
SkBitmap bm;
bm.allocN32Pixels(2, 2);
*bm.getAddr32(0, 0) = *bm.getAddr32(1, 1) = 0xFFFFFFFF;
@@ -69,17 +69,15 @@ static SkShader* make_bg_shader() {
SkMatrix m;
m.setScale(SkIntToScalar(6), SkIntToScalar(6));
- return SkShader::CreateBitmapShader(bm,
- SkShader::kRepeat_TileMode,
- SkShader::kRepeat_TileMode,
- &m);
+ return SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode, &m);
}
class HairModesView : public SampleView {
SkPaint fBGPaint;
public:
HairModesView() {
- fBGPaint.setShader(make_bg_shader())->unref();
+ fBGPaint.setShader(make_bg_shader());
}
protected:
« no previous file with comments | « samplecode/SampleGradients.cpp ('k') | samplecode/SampleLayers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698