msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 8 | #ifndef DecodingBench_DEFINED |
| 9 | #define DecodingBench_DEFINED |
| 10 | |
msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 11 | #include "Benchmark.h" |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 12 | #include "SkData.h" |
msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 13 | #include "SkImageDecoder.h" |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 14 | #include "SkRefCnt.h" |
msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 15 | #include "SkString.h" |
| 16 | |
| 17 | /* |
| 18 | * |
| 19 | * This benchmark is designed to test the performance of image decoding. |
| 20 | * It is invoked from the nanobench.cpp file. |
| 21 | * |
| 22 | */ |
| 23 | class DecodingBench : public Benchmark { |
| 24 | public: |
| 25 | DecodingBench(SkString path, SkColorType colorType); |
| 26 | |
| 27 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 28 | const char* onGetName() override; |
| 29 | bool isSuitableFor(Backend backend) override; |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 30 | void onDraw(int n, SkCanvas* canvas) override; |
joshualitt | 8a6697a | 2015-09-30 12:11:07 -0700 | [diff] [blame] | 31 | void onDelayedSetup() override; |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 32 | |
msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 33 | private: |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 34 | SkString fName; |
| 35 | SkColorType fColorType; |
| 36 | SkAutoTUnref<SkData> fData; |
scroggo | 2102799 | 2015-04-02 13:22:38 -0700 | [diff] [blame] | 37 | SkAutoMalloc fPixelStorage; |
msarett | 95f192d | 2015-02-13 09:05:41 -0800 | [diff] [blame] | 38 | typedef Benchmark INHERITED; |
| 39 | }; |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 40 | #endif // DecodingBench_DEFINED |