use Make instead of Create to return a shared shader
Partially updated call sites. Undefine the flag in SkSHader.h to convert the remaining sites.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1772463002
Review URL: https://codereview.chromium.org/1772463002
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index eb3e134..639203b 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "SampleCode.h"
#include "SkView.h"
#include "SkCanvas.h"
@@ -78,10 +79,8 @@
// of our pts[] array.
const SkScalar pos[] = { 0, 0.9f, SK_Scalar1 };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 3,
- SkShader::kClamp_TileMode);
SkPaint p;
- p.setShader(s)->unref();
+ p.setShader(SkGradientShader::MakeLinear(pts, colors, pos, 3, SkShader::kClamp_TileMode));
p.setXfermodeMode(SkXfermode::kDstIn_Mode);
canvas->drawRect(bounds, p);
@@ -105,10 +104,9 @@
const SkPoint pts[] = { { x, y }, { x + paint.measureText(str, len), y } };
const SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, 0 };
const SkScalar pos[] = { 0, 0.9f, 1 };
- SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos,
+ paint.setShader(SkGradientShader::MakeLinear(pts, colors, pos,
SK_ARRAY_COUNT(colors),
- SkShader::kClamp_TileMode);
- paint.setShader(s)->unref();
+ SkShader::kClamp_TileMode));
canvas->drawText(str, len, x, y, paint);
y += 20;