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

Unified Diff: gm/vertices.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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/transparency.cpp ('k') | gm/verylargebitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/vertices.cpp
diff --git a/gm/vertices.cpp b/gm/vertices.cpp
index 31fb3527248b5f38ee4e057a4ab073deffb3a58c..177dc43c2b7bc83b4d7838defc0cea3bc405cb52 100644
--- a/gm/vertices.cpp
+++ b/gm/vertices.cpp
@@ -11,20 +11,19 @@
#include "SkGradientShader.h"
#include "SkRandom.h"
-static SkShader* make_shader1(SkScalar w, SkScalar h) {
+static sk_sp<SkShader> make_shader1(SkScalar w, SkScalar h) {
const SkColor colors[] = {
SK_ColorRED, SK_ColorCYAN, SK_ColorGREEN, SK_ColorWHITE,
SK_ColorMAGENTA, SK_ColorBLUE, SK_ColorYELLOW,
};
const SkPoint pts[] = { { w/4, 0 }, { 3*w/4, h } };
- return SkGradientShader::CreateLinear(pts, colors, nullptr,
- SK_ARRAY_COUNT(colors),
- SkShader::kMirror_TileMode);
+ return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
+ SkShader::kMirror_TileMode);
}
-static SkShader* make_shader2() {
- return SkShader::CreateColorShader(SK_ColorBLUE);
+static sk_sp<SkShader> make_shader2() {
+ return SkShader::MakeColorShader(SK_ColorBLUE);
}
static SkColorFilter* make_color_filter() {
@@ -35,8 +34,8 @@ class VerticesGM : public skiagm::GM {
SkPoint fPts[9];
SkPoint fTexs[9];
SkColor fColors[9];
- SkAutoTUnref<SkShader> fShader1;
- SkAutoTUnref<SkShader> fShader2;
+ sk_sp<SkShader> fShader1;
+ sk_sp<SkShader> fShader2;
SkAutoTUnref<SkColorFilter> fColorFilter;
public:
@@ -59,8 +58,8 @@ protected:
fTexs[3].set(0, h/2); fTexs[4].set(w/2, h/2); fTexs[5].set(w, h/2);
fTexs[6].set(0, h); fTexs[7].set(w/2, h); fTexs[8].set(w, h);
- fShader1.reset(make_shader1(w, h));
- fShader2.reset(make_shader2());
+ fShader1 = make_shader1(w, h);
+ fShader2 = make_shader2();
fColorFilter.reset(make_color_filter());
SkRandom rand;
@@ -86,11 +85,11 @@ protected:
};
const struct {
- const SkColor* fColors;
- const SkPoint* fTexs;
- SkShader* fShader;
- SkColorFilter* fColorFilter;
- uint8_t fAlpha;
+ const SkColor* fColors;
+ const SkPoint* fTexs;
+ const sk_sp<SkShader>& fShader;
+ SkColorFilter* fColorFilter;
+ uint8_t fAlpha;
} rec[] = {
{ fColors, nullptr, fShader1, nullptr , 0xFF },
{ nullptr, fTexs , fShader1, nullptr , 0xFF },
« no previous file with comments | « gm/transparency.cpp ('k') | gm/verylargebitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698