Index: samplecode/SampleRegion.cpp |
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp |
index eb3e134af9ef7db48514aa80523dcdeb502fdca4..639203b8bc58a1a153e5e23b5236b43ff53d5889 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 @@ static void drawFadingText(SkCanvas* canvas, |
// 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 @@ static void test_text(SkCanvas* canvas) { |
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; |