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