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