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

Unified Diff: samplecode/SampleClamp.cpp

Issue 1803783002: Reland of "Finish conversion to sk_sp<SkShader> (patchset #2 id:20001 of https://codereview.chromiu… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update cmake example 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/core/SkShader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleClamp.cpp
diff --git a/samplecode/SampleClamp.cpp b/samplecode/SampleClamp.cpp
index e319a56dc4f3d59f835a56536c0ce4b5cb945b17..97390535223324c83d8bf5246a954ff84897b8a7 100644
--- a/samplecode/SampleClamp.cpp
+++ b/samplecode/SampleClamp.cpp
@@ -13,25 +13,20 @@
#include "SkGradientShader.h"
#include "SkPicture.h"
-static SkShader* make_linear() {
+static sk_sp<SkShader> make_linear() {
SkPoint pts[] = { 0, 0, SK_Scalar1/500, SK_Scalar1/500 };
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
- return SkGradientShader::CreateLinear(pts, colors, nullptr, 2,
- SkShader::kClamp_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
}
class ClampView : public SampleView {
- SkShader* fGrad;
+ sk_sp<SkShader> fGrad;
public:
ClampView() {
fGrad = make_linear();
}
- virtual ~ClampView() {
- fGrad->unref();
- }
-
protected:
// overrides from SkEventSink
virtual bool onQuery(SkEvent* evt) {
« no previous file with comments | « include/core/SkShader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698