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

Unified Diff: bench/AlternatingColorPatternBench.cpp

Issue 1803783002: Reland of "Finish conversion to sk_sp<SkShader> (patchset #2 id:20001 of https://codereview.chromiu… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update cmake example 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 | « no previous file | bench/ColorCubeBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/AlternatingColorPatternBench.cpp
diff --git a/bench/AlternatingColorPatternBench.cpp b/bench/AlternatingColorPatternBench.cpp
index b7285d6e3bfbe2bd93ef6fd6496cdfb099168d10..147dc3607b53ff271211694c88bc4bf13600bff8 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -51,11 +51,11 @@ static void makebm(SkBitmap* bm, int w, int h) {
SkPaint paint;
- paint.setShader(SkGradientShader::CreateLinear(kPts0, kColors0, kPos,
- SK_ARRAY_COUNT(kColors0), SkShader::kClamp_TileMode))->unref();
+ paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos, SK_ARRAY_COUNT(kColors0),
+ SkShader::kClamp_TileMode));
canvas.drawPaint(paint);
- paint.setShader(SkGradientShader::CreateLinear(kPts1, kColors1, kPos,
- SK_ARRAY_COUNT(kColors1), SkShader::kClamp_TileMode))->unref();
+ paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos, SK_ARRAY_COUNT(kColors1),
+ SkShader::kClamp_TileMode));
canvas.drawPaint(paint);
}
@@ -80,12 +80,12 @@ public:
NY = 5,
NUM_DRAWS = NX * NY,
};
- SkShader* fBmShader;
+ sk_sp<SkShader> fBmShader;
SkPath fPaths[NUM_DRAWS];
SkRect fRects[NUM_DRAWS];
SkColor fColors[NUM_DRAWS];
- SkShader* fShaders[NUM_DRAWS];
+ sk_sp<SkShader> fShaders[NUM_DRAWS];
SkString fName;
ColorPatternData fPattern1;
@@ -94,8 +94,7 @@ public:
SkBitmap fBmp;
- AlternatingColorPatternBench(ColorPattern pattern1, ColorPattern pattern2, DrawType drawType)
- : fBmShader(nullptr) {
+ AlternatingColorPatternBench(ColorPattern pattern1, ColorPattern pattern2, DrawType drawType) {
fPattern1 = gColorPatterns[pattern1];
fPattern2 = gColorPatterns[pattern2];
fName.printf("colorPattern_%s_%s_%s",
@@ -104,10 +103,6 @@ public:
fDrawType = drawType;
}
- virtual ~AlternatingColorPatternBench() {
- SkSafeUnref(fBmShader);
- }
-
protected:
const char* onGetName() override {
return fName.c_str();
@@ -117,7 +112,7 @@ protected:
int w = 40;
int h = 40;
makebm(&fBmp, w, h);
- fBmShader = SkShader::CreateBitmapShader(fBmp,
+ fBmShader = SkShader::MakeBitmapShader(fBmp,
SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
int offset = 2;
« no previous file with comments | « no previous file | bench/ColorCubeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698