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

Unified Diff: bench/ColorCubeBench.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 | « bench/AlternatingColorPatternBench.cpp ('k') | bench/GameBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/ColorCubeBench.cpp
diff --git a/bench/ColorCubeBench.cpp b/bench/ColorCubeBench.cpp
index 6c5a16d6a212bf03d362408ef71742dcb0fb7dc7..9f6bd001ff00b5b972dad83acce4d87f65ea7386 100644
--- a/bench/ColorCubeBench.cpp
+++ b/bench/ColorCubeBench.cpp
@@ -48,13 +48,13 @@ protected:
}
private:
- static SkShader* MakeLinear(const SkISize& size) {
+ static sk_sp<SkShader> MakeLinear(const SkISize& size) {
const SkPoint pts[2] = {
{ 0, 0 },
{ SkIntToScalar(size.width()), SkIntToScalar(size.height()) }
};
static const SkColor colors[] = { SK_ColorYELLOW, SK_ColorBLUE };
- return SkGradientShader::CreateLinear(
+ return SkGradientShader::MakeLinear(
pts, colors, nullptr, 2, SkShader::kRepeat_TileMode, 0, &SkMatrix::I());
}
@@ -64,11 +64,9 @@ private:
canvas.clear(0x00000000);
SkPaint paint;
paint.setAntiAlias(true);
- SkShader* shader = MakeLinear(fSize);
- paint.setShader(shader);
+ paint.setShader(MakeLinear(fSize));
SkRect r = { 0, 0, SkIntToScalar(fSize.width()), SkIntToScalar(fSize.height()) };
canvas.drawRect(r, paint);
- shader->unref();
}
void makeCubeData() {
« no previous file with comments | « bench/AlternatingColorPatternBench.cpp ('k') | bench/GameBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698