OLD | NEW |
---|---|
(Empty) | |
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 #include "Benchmark.h" | |
9 #include "SkImageDecoder.h" | |
10 #include "SkImageInfo.h" | |
11 #include "SkStream.h" | |
12 #include "SkString.h" | |
13 | |
14 /* | |
15 * | |
16 * This benchmark is designed to test the performance of subset decoding. | |
17 * | |
18 */ | |
19 class CodecSubsetBench : public Benchmark { | |
20 public: | |
21 | |
22 // Defines the style of the subset decoding benchmark. | |
23 enum SubsetMode { | |
24 // Use an input width, height, left, and top to decode a single subset. | |
25 // Must specify: subsetWidth, subsetHeight, offsetLeft, offsetTop | |
scroggo
2015/05/29 15:36:03
It might be clearer to have different constructors
msarett
2015/06/01 14:03:25
I am splitting the benchmark into separate subclas
| |
26 kSingle_SubsetMode, | |
27 | |
28 // Use a divisor to decode the entire image in a grid of divisor x divis or blocks. | |
29 // Must specify: divisor | |
30 kDivisor_SubsetMode, | |
31 | |
32 // Use input dimensions to decode the entire image where each block is s usbetW x subsetH. | |
33 // Must specify: subsetWidth, subsetHeight | |
34 kTranslate_SubsetMode, | |
35 | |
36 // Choose subsets to mimic a user zooming out on a photo | |
scroggo
2015/05/29 15:36:03
nit: zooming in* ?
msarett
2015/06/01 14:03:25
It mimics zooming out. The subsets get bigger eac
| |
37 // Must specify: subsetWidth, subsetHeight | |
38 kScale_SubsetMode | |
39 }; | |
40 | |
41 CodecSubsetBench(SkString* path, | |
42 SubsetMode subsetMode, | |
43 SkColorType colorType, | |
44 uint32_t subsetWidth, | |
45 uint32_t subsetHeight, | |
46 uint32_t offsetLeft, | |
47 uint32_t offsetTop, | |
48 uint32_t divisor, | |
49 bool useCodec); | |
50 | |
51 protected: | |
52 const char* onGetName() override; | |
53 bool isSuitableFor(Backend backend) override; | |
54 void onDraw(const int n, SkCanvas* canvas) override; | |
55 | |
56 private: | |
57 | |
58 SkString fName; | |
59 SubsetMode fSubsetMode; | |
60 SkColorType fColorType; | |
61 const uint32_t fSubsetWidth; | |
62 const uint32_t fSubsetHeight; | |
63 const uint32_t fOffsetLeft; | |
64 const uint32_t fOffsetTop; | |
65 const uint32_t fDivisor; | |
66 const bool fUseCodec; | |
67 SkAutoTDelete<SkMemoryStream> fStream; | |
68 typedef Benchmark INHERITED; | |
69 }; | |
OLD | NEW |