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

Unified Diff: samplecode/PerlinPatch.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 | « include/effects/SkGradientShader.h ('k') | samplecode/Sample2PtRadial.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/PerlinPatch.cpp
diff --git a/samplecode/PerlinPatch.cpp b/samplecode/PerlinPatch.cpp
index de4d45164810f14e33e97b20df5f12e0ed063cd4..ad2d6bede0e3683a1c604ccef858e18b58ca9496 100644
--- a/samplecode/PerlinPatch.cpp
+++ b/samplecode/PerlinPatch.cpp
@@ -60,9 +60,9 @@ const SkScalar TexWidth = 100.0f;
const SkScalar TexHeight = 100.0f;
class PerlinPatchView : public SampleView {
- SkShader* fShader0;
- SkShader* fShader1;
- SkShader* fShaderCompose;
+ sk_sp<SkShader> fShader0;
+ sk_sp<SkShader> fShader1;
+ sk_sp<SkShader> fShaderCompose;
SkScalar fXFreq;
SkScalar fYFreq;
SkScalar fSeed;
@@ -98,7 +98,7 @@ public:
};
const SkPoint points[2] = { SkPoint::Make(0.0f, 0.0f),
SkPoint::Make(100.0f, 100.0f) };
- fShader0 = SkGradientShader::CreateLinear(points,
+ fShader0 = SkGradientShader::MakeLinear(points,
colors,
NULL,
3,
@@ -107,9 +107,6 @@ public:
NULL);
}
- virtual ~PerlinPatchView() {
- SkSafeUnref(fShader0);
- }
protected:
// overrides from SkEventSink
bool onQuery(SkEvent* evt) override {
@@ -145,16 +142,14 @@ protected:
SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(SkXfermode::kSrc_Mode));
SkScalar scaleFreq = 2.0;
- fShader1 = SkPerlinNoiseShader2::CreateImprovedNoise(fXFreq/scaleFreq, fYFreq/scaleFreq, 4,
+ fShader1 = SkPerlinNoiseShader2::MakeImprovedNoise(fXFreq/scaleFreq, fYFreq/scaleFreq, 4,
fSeed);
- fShaderCompose = SkShader::CreateComposeShader(fShader0, fShader1, nullptr);
+ fShaderCompose = SkShader::MakeComposeShader(fShader0, fShader1, nullptr);
paint.setShader(fShaderCompose);
canvas->drawPatch(fPts, nullptr, texCoords, xfer, paint);
draw_control_points(canvas, fPts);
- SkSafeUnref(fShader1);
- SkSafeUnref(fShaderCompose);
}
class PtClick : public Click {
« no previous file with comments | « include/effects/SkGradientShader.h ('k') | samplecode/Sample2PtRadial.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698