| 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" |
| 11 #include "SkBitmapProcShader.h" |
| 11 #include "SkPM4f.h" | 12 #include "SkPM4f.h" |
| 12 #include "Benchmark.h" | 13 #include "Benchmark.h" |
| 13 #include "SkShader.h" | 14 #include "SkShader.h" |
| 14 #include "SkImage.h" | 15 #include "SkImage.h" |
| 15 | 16 |
| 16 struct CommonBitmapFPBenchmark : public Benchmark { | 17 struct CommonBitmapFPBenchmark : public Benchmark { |
| 17 CommonBitmapFPBenchmark( | 18 CommonBitmapFPBenchmark( |
| 18 SkISize srcSize, | 19 SkISize srcSize, |
| 19 SkColorProfileType colorProfile, | 20 SkColorProfileType colorProfile, |
| 20 SkMatrix m, | 21 SkMatrix m, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void onPostDraw(SkCanvas*) override { | 187 void onPostDraw(SkCanvas*) override { |
| 187 | 188 |
| 188 } | 189 } |
| 189 | 190 |
| 190 void onDraw(int loops, SkCanvas*) override { | 191 void onDraw(int loops, SkCanvas*) override { |
| 191 int width = fSrcSize.fWidth; | 192 int width = fSrcSize.fWidth; |
| 192 int height = fSrcSize.fHeight; | 193 int height = fSrcSize.fHeight; |
| 193 | 194 |
| 194 SkAutoTMalloc<SkPMColor> buffer4b(width*height); | 195 SkAutoTMalloc<SkPMColor> buffer4b(width*height); |
| 195 | 196 |
| 196 uint32_t storage[300]; | 197 uint32_t storage[kSkBlitterContextSize]; |
| 197 const SkShader::ContextRec rec(fPaint, fM, nullptr, | 198 const SkShader::ContextRec rec(fPaint, fM, nullptr, |
| 198 SkShader::ContextRec::kPMColor_DstType); | 199 SkShader::ContextRec::kPMColor_DstType); |
| 199 SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage)); | 200 SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage)); |
| 200 SkShader::Context* ctx = fPaint.getShader()->createContext(rec, storage)
; | 201 SkShader::Context* ctx = fPaint.getShader()->createContext(rec, storage)
; |
| 201 | 202 |
| 202 int count = 100; | 203 int count = 100; |
| 203 | 204 |
| 204 for (int n = 0; n < 1000*loops; n++) { | 205 for (int n = 0; n < 1000*loops; n++) { |
| 205 ctx->shadeSpan(3, 6, buffer4b, count); | 206 ctx->shadeSpan(3, 6, buffer4b, count); |
| 206 } | 207 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 srcSize, kSRGB_SkColorProfileType, mR, true, | 336 srcSize, kSRGB_SkColorProfileType, mR, true, |
| 336 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) | 337 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 337 | 338 |
| 338 DEF_BENCH(return new SkBitmapFPGeneral( | 339 DEF_BENCH(return new SkBitmapFPGeneral( |
| 339 srcSize, kLinear_SkColorProfileType, mR, true, | 340 srcSize, kLinear_SkColorProfileType, mR, true, |
| 340 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) | 341 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| 341 | 342 |
| 342 DEF_BENCH(return new SkBitmapFPOrigShader( | 343 DEF_BENCH(return new SkBitmapFPOrigShader( |
| 343 srcSize, kLinear_SkColorProfileType, mR, true, | 344 srcSize, kLinear_SkColorProfileType, mR, true, |
| 344 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) | 345 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |
| OLD | NEW |