Index: gm/transparency.cpp |
diff --git a/gm/transparency.cpp b/gm/transparency.cpp |
index 73bd8b20235f3add7320fdfd8575bb267d89d8be..5e057617d4349828e346359af0b51a6dbbd1a53a 100644 |
--- a/gm/transparency.cpp |
+++ b/gm/transparency.cpp |
@@ -9,9 +9,7 @@ |
#include "SkSurface.h" |
#include "gm.h" |
-static void make_transparency(SkCanvas* canvas, |
- SkScalar width, |
- SkScalar height) { |
+static void make_transparency(SkCanvas* canvas, SkScalar width, SkScalar height) { |
SkPoint pts[2]; |
pts[0] = SkPoint::Make(0, 0); |
pts[1] = SkPoint::Make(width, 0); |
@@ -31,30 +29,27 @@ static void make_transparency(SkCanvas* canvas, |
SkColor shaderColors[2]; |
shaderColors[0] = SK_AlphaTRANSPARENT; |
shaderColors[1] = kColors[i]; |
- SkAutoTUnref<SkShader> shader(SkGradientShader::CreateLinear( |
- pts, shaderColors, nullptr, 2, SkShader::kClamp_TileMode)); |
- SkRect r = SkRect::MakeXYWH(0, i * kRowHeight, width, kRowHeight); |
SkPaint p; |
- p.setShader(shader); |
- canvas->drawRect(r, p); |
+ p.setShader(SkGradientShader::MakeLinear(pts, shaderColors, nullptr, 2, |
+ SkShader::kClamp_TileMode)); |
+ canvas->drawRect(SkRect::MakeXYWH(0, i * kRowHeight, width, kRowHeight), p); |
} |
} |
// http://crrev.com/834303005 |
-static SkShader* create_checkerboard_shader(SkColor c1, SkColor c2, int size) { |
+static sk_sp<SkShader> create_checkerboard_shader(SkColor c1, SkColor c2, int size) { |
SkBitmap bm; |
bm.allocN32Pixels(2 * size, 2 * size); |
bm.eraseColor(c1); |
bm.eraseArea(SkIRect::MakeLTRB(0, 0, size, size), c2); |
bm.eraseArea(SkIRect::MakeLTRB(size, size, 2 * size, 2 * size), c2); |
- return SkShader::CreateBitmapShader(bm, SkShader::kRepeat_TileMode, |
- SkShader::kRepeat_TileMode); |
+ return SkShader::MakeBitmapShader(bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); |
} |
// http://crrev.com/834303005 |
static void checkerboard(SkCanvas* canvas, SkColor c1, SkColor c2, int size) { |
SkPaint paint; |
- paint.setShader(create_checkerboard_shader(c1, c2, size))->unref(); |
+ paint.setShader(create_checkerboard_shader(c1, c2, size)); |
canvas->drawPaint(paint); |
} |