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

Unified Diff: samplecode/SampleRegion.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/SampleQuadStroker.cpp ('k') | samplecode/SampleRepeatTile.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « samplecode/SampleQuadStroker.cpp ('k') | samplecode/SampleRepeatTile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698