OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkLinearBitmapPipeline.h" | 10 #include "SkLinearBitmapPipeline.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 SkFilterQuality filterQuality; | 138 SkFilterQuality filterQuality; |
139 if (fUseBilerp) { | 139 if (fUseBilerp) { |
140 filterQuality = SkFilterQuality::kLow_SkFilterQuality; | 140 filterQuality = SkFilterQuality::kLow_SkFilterQuality; |
141 } else { | 141 } else { |
142 filterQuality = SkFilterQuality::kNone_SkFilterQuality; | 142 filterQuality = SkFilterQuality::kNone_SkFilterQuality; |
143 } | 143 } |
144 | 144 |
145 SkPixmap srcPixmap{fInfo, fBitmap.get(), static_cast<size_t>(4 * width)}
; | 145 SkPixmap srcPixmap{fInfo, fBitmap.get(), static_cast<size_t>(4 * width)}
; |
146 | 146 |
147 SkLinearBitmapPipeline pipeline{ | 147 SkLinearBitmapPipeline pipeline{ |
148 fInvert, filterQuality, fXTile, fYTile, srcPixmap}; | 148 fInvert, filterQuality, fXTile, fYTile, 1.0f, srcPixmap}; |
149 | 149 |
150 int count = 100; | 150 int count = 100; |
151 | 151 |
152 for (int n = 0; n < 1000*loops; n++) { | 152 for (int n = 0; n < 1000*loops; n++) { |
153 pipeline.shadeSpan4f(3, 6, FPbuffer, count); | 153 pipeline.shadeSpan4f(3, 6, FPbuffer, count); |
154 } | 154 } |
155 } | 155 } |
156 }; | 156 }; |
157 | 157 |
158 struct SkBitmapFPOrigShader : public CommonBitmapFPBenchmark { | 158 struct SkBitmapFPOrigShader : public CommonBitmapFPBenchmark { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 255 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
256 | 256 |
257 DEF_BENCH(return new SkBitmapFPGeneral( | 257 DEF_BENCH(return new SkBitmapFPGeneral( |
258 srcSize, kLinear_SkColorProfileType, mS, true, | 258 srcSize, kLinear_SkColorProfileType, mS, true, |
259 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 259 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
260 | 260 |
261 DEF_BENCH(return new SkBitmapFPOrigShader( | 261 DEF_BENCH(return new SkBitmapFPOrigShader( |
262 srcSize, kLinear_SkColorProfileType, mS, true, | 262 srcSize, kLinear_SkColorProfileType, mS, true, |
263 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 263 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
264 | 264 |
| 265 // Repeat |
| 266 DEF_BENCH(return new SkBitmapFPGeneral( |
| 267 srcSize, kSRGB_SkColorProfileType, mS, false, |
| 268 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 269 |
| 270 DEF_BENCH(return new SkBitmapFPGeneral( |
| 271 srcSize, kLinear_SkColorProfileType, mS, false, |
| 272 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 273 |
| 274 DEF_BENCH(return new SkBitmapFPOrigShader( |
| 275 srcSize, kLinear_SkColorProfileType, mS, false, |
| 276 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 277 |
| 278 DEF_BENCH(return new SkBitmapFPGeneral( |
| 279 srcSize, kSRGB_SkColorProfileType, mS, true, |
| 280 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 281 |
| 282 DEF_BENCH(return new SkBitmapFPGeneral( |
| 283 srcSize, kLinear_SkColorProfileType, mS, true, |
| 284 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 285 |
| 286 DEF_BENCH(return new SkBitmapFPOrigShader( |
| 287 srcSize, kLinear_SkColorProfileType, mS, true, |
| 288 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 289 |
265 static SkMatrix rotate(SkScalar r) { | 290 static SkMatrix rotate(SkScalar r) { |
266 SkMatrix m; | 291 SkMatrix m; |
267 m.setRotate(30); | 292 m.setRotate(30); |
268 return m; | 293 return m; |
269 } | 294 } |
270 | 295 |
271 static SkMatrix mR = rotate(30); | 296 static SkMatrix mR = rotate(30); |
272 DEF_BENCH(return new SkBitmapFPGeneral( | 297 DEF_BENCH(return new SkBitmapFPGeneral( |
273 srcSize, kSRGB_SkColorProfileType, mR, false, | 298 srcSize, kSRGB_SkColorProfileType, mR, false, |
274 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 299 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
(...skipping 11 matching lines...) Expand all Loading... |
286 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 311 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
287 | 312 |
288 DEF_BENCH(return new SkBitmapFPGeneral( | 313 DEF_BENCH(return new SkBitmapFPGeneral( |
289 srcSize, kLinear_SkColorProfileType, mR, true, | 314 srcSize, kLinear_SkColorProfileType, mR, true, |
290 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 315 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
291 | 316 |
292 DEF_BENCH(return new SkBitmapFPOrigShader( | 317 DEF_BENCH(return new SkBitmapFPOrigShader( |
293 srcSize, kLinear_SkColorProfileType, mR, true, | 318 srcSize, kLinear_SkColorProfileType, mR, true, |
294 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) | 319 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) |
295 | 320 |
| 321 // Repeat |
| 322 DEF_BENCH(return new SkBitmapFPGeneral( |
| 323 srcSize, kSRGB_SkColorProfileType, mR, false, |
| 324 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 325 |
| 326 DEF_BENCH(return new SkBitmapFPGeneral( |
| 327 srcSize, kLinear_SkColorProfileType, mR, false, |
| 328 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 329 |
| 330 DEF_BENCH(return new SkBitmapFPOrigShader( |
| 331 srcSize, kLinear_SkColorProfileType, mR, false, |
| 332 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 333 |
| 334 DEF_BENCH(return new SkBitmapFPGeneral( |
| 335 srcSize, kSRGB_SkColorProfileType, mR, true, |
| 336 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 337 |
| 338 DEF_BENCH(return new SkBitmapFPGeneral( |
| 339 srcSize, kLinear_SkColorProfileType, mR, true, |
| 340 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 341 |
| 342 DEF_BENCH(return new SkBitmapFPOrigShader( |
| 343 srcSize, kLinear_SkColorProfileType, mR, true, |
| 344 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 345 |
| 346 |
OLD | NEW |