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; |