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

Unified Diff: gm/colorcube.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container 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 | « gm/color4f.cpp ('k') | gm/coloremoji.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/colorcube.cpp
diff --git a/gm/colorcube.cpp b/gm/colorcube.cpp
index fa9eea9f99098d6b5020070fd233367288ec1ca5..01aaf156107968e1220681f6331317ae5ae95a04 100644
--- a/gm/colorcube.cpp
+++ b/gm/colorcube.cpp
@@ -13,14 +13,14 @@
namespace skiagm {
-static SkShader* MakeLinear() {
+static sk_sp<SkShader> MakeLinear() {
static const SkPoint pts[2] = {
{ 0, 0 },
{ SkIntToScalar(80), SkIntToScalar(80) }
};
static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE };
- return SkGradientShader::CreateLinear(
- pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I());
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0,
+ &SkMatrix::I());
}
class ColorCubeGM : public GM {
@@ -63,11 +63,8 @@ protected:
canvas.clear(0x00000000);
SkPaint paint;
paint.setAntiAlias(true);
- SkShader* shader = MakeLinear();
- paint.setShader(shader);
- SkRect r = { 0, 0, SkIntToScalar(80), SkIntToScalar(80) };
- canvas.drawRect(r, paint);
- shader->unref();
+ paint.setShader(MakeLinear());
+ canvas.drawRect(SkRect::MakeWH(80, 80), paint);
}
void make_3Dlut(SkData** data, int size, bool invR, bool invG, bool invB) {
« no previous file with comments | « gm/color4f.cpp ('k') | gm/coloremoji.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698