OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef CodecBench_DEFINED |
| 9 #define CodecBench_DEFINED |
| 10 |
8 #include "Benchmark.h" | 11 #include "Benchmark.h" |
9 #include "SkImageDecoder.h" | |
10 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
11 #include "SkStream.h" | 13 #include "SkStream.h" |
12 #include "SkString.h" | 14 #include "SkString.h" |
13 | 15 |
14 /* | 16 class SkData; |
15 * | 17 |
16 * This benchmark is designed to test the performance of image decoding. | 18 /** |
17 * It is invoked from the nanobench.cpp file. | 19 * Time SkCodec. |
18 * | |
19 */ | 20 */ |
20 class DecodingBench : public Benchmark { | 21 class CodecBench : public Benchmark { |
21 public: | 22 public: |
22 DecodingBench(SkString path, SkColorType colorType); | 23 // Calls encoded->ref() |
| 24 CodecBench(SkString basename, SkData* encoded, SkColorType colorType); |
23 | 25 |
24 protected: | 26 protected: |
25 const char* onGetName() override; | 27 const char* onGetName() override; |
26 bool isSuitableFor(Backend backend) override; | 28 bool isSuitableFor(Backend backend) override; |
27 void onDraw(const int n, SkCanvas* canvas) override; | 29 void onDraw(const int n, SkCanvas* canvas) override; |
28 | 30 |
29 private: | 31 private: |
30 SkString fName; | 32 SkString fName; |
31 SkColorType fColorType; | 33 const SkColorType fColorType; |
32 SkAutoTDelete<SkMemoryStream> fStream; | 34 SkAutoTDelete<SkMemoryStream> fStream; |
33 SkAutoTDelete<SkImageDecoder> fDecoder; | |
34 typedef Benchmark INHERITED; | 35 typedef Benchmark INHERITED; |
35 }; | 36 }; |
| 37 #endif // CodecBench_DEFINED |
OLD | NEW |