scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [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 | |
| 8 | #ifndef CodecBench_DEFINED |
| 9 | #define CodecBench_DEFINED |
| 10 | |
| 11 | #include "Benchmark.h" |
Hal Canary | 95e3c05 | 2017-01-11 12:44:43 -0500 | [diff] [blame^] | 12 | #include "SkAutoMalloc.h" |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 13 | #include "SkData.h" |
| 14 | #include "SkImageInfo.h" |
| 15 | #include "SkRefCnt.h" |
| 16 | #include "SkString.h" |
| 17 | |
| 18 | /** |
| 19 | * Time SkCodec. |
| 20 | */ |
| 21 | class CodecBench : public Benchmark { |
| 22 | public: |
| 23 | // Calls encoded->ref() |
msarett | c7796b9 | 2016-01-07 14:20:20 -0800 | [diff] [blame] | 24 | CodecBench(SkString basename, SkData* encoded, SkColorType colorType, SkAlphaType alphaType); |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 25 | |
| 26 | protected: |
| 27 | const char* onGetName() override; |
| 28 | bool isSuitableFor(Backend backend) override; |
mtklein | a1ebeb2 | 2015-10-01 09:43:39 -0700 | [diff] [blame] | 29 | void onDraw(int n, SkCanvas* canvas) override; |
joshualitt | 8a6697a | 2015-09-30 12:11:07 -0700 | [diff] [blame] | 30 | void onDelayedSetup() override; |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | SkString fName; |
| 34 | const SkColorType fColorType; |
msarett | c7796b9 | 2016-01-07 14:20:20 -0800 | [diff] [blame] | 35 | const SkAlphaType fAlphaType; |
bungeman | ffae30d | 2016-08-03 13:32:32 -0700 | [diff] [blame] | 36 | sk_sp<SkData> fData; |
msarett | c7796b9 | 2016-01-07 14:20:20 -0800 | [diff] [blame] | 37 | SkImageInfo fInfo; // Set in onDelayedSetup. |
scroggo | 2102799 | 2015-04-02 13:22:38 -0700 | [diff] [blame] | 38 | SkAutoMalloc fPixelStorage; |
scroggo | 60869a4 | 2015-04-01 12:09:17 -0700 | [diff] [blame] | 39 | typedef Benchmark INHERITED; |
| 40 | }; |
| 41 | #endif // CodecBench_DEFINED |