OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "Benchmark.h" | 9 #include "Benchmark.h" |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 : fDoFilter(doFilter) | 46 : fDoFilter(doFilter) |
47 , fDoTrans(doTrans) | 47 , fDoTrans(doTrans) |
48 , fDoScale(doScale) { | 48 , fDoScale(doScale) { |
49 SkBitmap bm; | 49 SkBitmap bm; |
50 | 50 |
51 bm.allocN32Pixels(kWidth, kHeight, true); | 51 bm.allocN32Pixels(kWidth, kHeight, true); |
52 bm.eraseColor(SK_ColorWHITE); | 52 bm.eraseColor(SK_ColorWHITE); |
53 | 53 |
54 create_gradient(&bm); | 54 create_gradient(&bm); |
55 | 55 |
56 fPaint.setShader(SkShader::MakeBitmapShader(bm, xTile, yTile)); | 56 SkShader* s = SkShader::CreateBitmapShader(bm, xTile, yTile); |
| 57 fPaint.setShader(s)->unref(); |
57 | 58 |
58 fName.printf("constXTile_"); | 59 fName.printf("constXTile_"); |
59 | 60 |
60 static const char* gTileModeStr[SkShader::kTileModeCount] = { "C", "R",
"M" }; | 61 static const char* gTileModeStr[SkShader::kTileModeCount] = { "C", "R",
"M" }; |
61 fName.append(gTileModeStr[xTile]); | 62 fName.append(gTileModeStr[xTile]); |
62 fName.append(gTileModeStr[yTile]); | 63 fName.append(gTileModeStr[yTile]); |
63 | 64 |
64 if (doFilter) { | 65 if (doFilter) { |
65 fName.append("_filter"); | 66 fName.append("_filter"); |
66 } | 67 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 //DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kCla
mp_TileMode, true, false, true)) | 125 //DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kCla
mp_TileMode, true, false, true)) |
125 DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirr
or_TileMode, true, false, false)) | 126 DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirr
or_TileMode, true, false, false)) |
126 | 127 |
127 //DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRe
peat_TileMode, false, true, true)) | 128 //DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRe
peat_TileMode, false, true, true)) |
128 DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kClamp
_TileMode, false, true, false)) | 129 DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kClamp
_TileMode, false, true, false)) |
129 //DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMi
rror_TileMode, false, true, true)) | 130 //DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMi
rror_TileMode, false, true, true)) |
130 | 131 |
131 DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepe
at_TileMode, true, true, false)) | 132 DEF_BENCH(return new ConstXTileBench(SkShader::kRepeat_TileMode, SkShader::kRepe
at_TileMode, true, true, false)) |
132 //DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kCla
mp_TileMode, true, true, true)) | 133 //DEF_BENCH(return new ConstXTileBench(SkShader::kClamp_TileMode, SkShader::kCla
mp_TileMode, true, true, true)) |
133 DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirr
or_TileMode, true, true, false)) | 134 DEF_BENCH(return new ConstXTileBench(SkShader::kMirror_TileMode, SkShader::kMirr
or_TileMode, true, true, false)) |
OLD | NEW |