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

Unified Diff: bench/AlternatingColorPatternBench.cpp

Issue 1798133003: Revert of Finish conversion to sk_sp<SkShader> (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 | « 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 147dc3607b53ff271211694c88bc4bf13600bff8..b7285d6e3bfbe2bd93ef6fd6496cdfb099168d10 100644
--- a/bench/AlternatingColorPatternBench.cpp
+++ b/bench/AlternatingColorPatternBench.cpp
@@ -51,11 +51,11 @@
SkPaint paint;
- paint.setShader(SkGradientShader::MakeLinear(kPts0, kColors0, kPos, SK_ARRAY_COUNT(kColors0),
- SkShader::kClamp_TileMode));
+ paint.setShader(SkGradientShader::CreateLinear(kPts0, kColors0, kPos,
+ SK_ARRAY_COUNT(kColors0), SkShader::kClamp_TileMode))->unref();
canvas.drawPaint(paint);
- paint.setShader(SkGradientShader::MakeLinear(kPts1, kColors1, kPos, SK_ARRAY_COUNT(kColors1),
- SkShader::kClamp_TileMode));
+ paint.setShader(SkGradientShader::CreateLinear(kPts1, kColors1, kPos,
+ SK_ARRAY_COUNT(kColors1), SkShader::kClamp_TileMode))->unref();
canvas.drawPaint(paint);
}
@@ -80,12 +80,12 @@
NY = 5,
NUM_DRAWS = NX * NY,
};
- sk_sp<SkShader> fBmShader;
+ SkShader* fBmShader;
SkPath fPaths[NUM_DRAWS];
SkRect fRects[NUM_DRAWS];
SkColor fColors[NUM_DRAWS];
- sk_sp<SkShader> fShaders[NUM_DRAWS];
+ SkShader* fShaders[NUM_DRAWS];
SkString fName;
ColorPatternData fPattern1;
@@ -94,7 +94,8 @@
SkBitmap fBmp;
- AlternatingColorPatternBench(ColorPattern pattern1, ColorPattern pattern2, DrawType drawType) {
+ AlternatingColorPatternBench(ColorPattern pattern1, ColorPattern pattern2, DrawType drawType)
+ : fBmShader(nullptr) {
fPattern1 = gColorPatterns[pattern1];
fPattern2 = gColorPatterns[pattern2];
fName.printf("colorPattern_%s_%s_%s",
@@ -103,6 +104,10 @@
fDrawType = drawType;
}
+ virtual ~AlternatingColorPatternBench() {
+ SkSafeUnref(fBmShader);
+ }
+
protected:
const char* onGetName() override {
return fName.c_str();
@@ -112,7 +117,7 @@
int w = 40;
int h = 40;
makebm(&fBmp, w, h);
- fBmShader = SkShader::MakeBitmapShader(fBmp,
+ fBmShader = SkShader::CreateBitmapShader(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