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

Unified Diff: gm/vertices.cpp

Issue 1790353002: Revert of more shader-->sp conversions (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 | « 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 177dc43c2b7bc83b4d7838defc0cea3bc405cb52..31fb3527248b5f38ee4e057a4ab073deffb3a58c 100644
--- a/gm/vertices.cpp
+++ b/gm/vertices.cpp
@@ -11,19 +11,20 @@
#include "SkGradientShader.h"
#include "SkRandom.h"
-static sk_sp<SkShader> make_shader1(SkScalar w, SkScalar h) {
+static 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::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(colors),
- SkShader::kMirror_TileMode);
+ return SkGradientShader::CreateLinear(pts, colors, nullptr,
+ SK_ARRAY_COUNT(colors),
+ SkShader::kMirror_TileMode);
}
-static sk_sp<SkShader> make_shader2() {
- return SkShader::MakeColorShader(SK_ColorBLUE);
+static SkShader* make_shader2() {
+ return SkShader::CreateColorShader(SK_ColorBLUE);
}
static SkColorFilter* make_color_filter() {
@@ -34,8 +35,8 @@
SkPoint fPts[9];
SkPoint fTexs[9];
SkColor fColors[9];
- sk_sp<SkShader> fShader1;
- sk_sp<SkShader> fShader2;
+ SkAutoTUnref<SkShader> fShader1;
+ SkAutoTUnref<SkShader> fShader2;
SkAutoTUnref<SkColorFilter> fColorFilter;
public:
@@ -58,8 +59,8 @@
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 = make_shader1(w, h);
- fShader2 = make_shader2();
+ fShader1.reset(make_shader1(w, h));
+ fShader2.reset(make_shader2());
fColorFilter.reset(make_color_filter());
SkRandom rand;
@@ -85,11 +86,11 @@
};
const struct {
- const SkColor* fColors;
- const SkPoint* fTexs;
- const sk_sp<SkShader>& fShader;
- SkColorFilter* fColorFilter;
- uint8_t fAlpha;
+ const SkColor* fColors;
+ const SkPoint* fTexs;
+ 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