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 BitmapRegionDecoderBench_DEFINED | 8 #ifndef BitmapRegionDecoderBench_DEFINED |
9 #define BitmapRegionDecoderBench_DEFINED | 9 #define BitmapRegionDecoderBench_DEFINED |
10 | 10 |
11 #include "Benchmark.h" | 11 #include "Benchmark.h" |
12 #include "SkBitmapRegionDecoder.h" | 12 #include "SkBitmapRegionDecoder.h" |
13 #include "SkData.h" | 13 #include "SkData.h" |
14 #include "SkImageInfo.h" | 14 #include "SkImageInfo.h" |
15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
16 #include "SkString.h" | 16 #include "SkString.h" |
17 | 17 |
18 /** | 18 /** |
19 * Benchmark Android's BitmapRegionDecoder for a particular colorType, sampleSi
ze, and subset. | 19 * Benchmark Android's BitmapRegionDecoder for a particular colorType, sampleSi
ze, and subset. |
20 * | 20 * |
21 * fStrategy determines which of various implementations is to be used. | |
22 * | |
23 * nanobench.cpp handles creating benchmarks for interesting scaled subsets. W
e strive to test | 21 * nanobench.cpp handles creating benchmarks for interesting scaled subsets. W
e strive to test |
24 * on real use cases. | 22 * on real use cases. |
25 */ | 23 */ |
26 class BitmapRegionDecoderBench : public Benchmark { | 24 class BitmapRegionDecoderBench : public Benchmark { |
27 public: | 25 public: |
28 // Calls encoded->ref() | 26 // Calls encoded->ref() |
29 BitmapRegionDecoderBench(const char* basename, SkData* encoded, | 27 BitmapRegionDecoderBench(const char* basename, SkData* encoded, SkColorType
colorType, |
30 SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType, | |
31 uint32_t sampleSize, const SkIRect& subset); | 28 uint32_t sampleSize, const SkIRect& subset); |
32 | 29 |
33 protected: | 30 protected: |
34 const char* onGetName() override; | 31 const char* onGetName() override; |
35 bool isSuitableFor(Backend backend) override; | 32 bool isSuitableFor(Backend backend) override; |
36 void onDraw(int n, SkCanvas* canvas) override; | 33 void onDraw(int n, SkCanvas* canvas) override; |
37 void onDelayedSetup() override; | 34 void onDelayedSetup() override; |
38 | 35 |
39 private: | 36 private: |
40 SkString fName; | 37 SkString fName; |
41 SkAutoTDelete<SkBitmapRegionDecoder> fBRD; | 38 SkAutoTDelete<SkBitmapRegionDecoder> fBRD; |
42 SkAutoTUnref<SkData> fData; | 39 SkAutoTUnref<SkData> fData; |
43 const SkBitmapRegionDecoder::Strategy fStrategy; | |
44 const SkColorType fColorType; | 40 const SkColorType fColorType; |
45 const uint32_t fSampleSize; | 41 const uint32_t fSampleSize; |
46 const SkIRect fSubset; | 42 const SkIRect fSubset; |
47 typedef Benchmark INHERITED; | 43 typedef Benchmark INHERITED; |
48 }; | 44 }; |
49 #endif // BitmapRegionDecoderBench_DEFINED | 45 #endif // BitmapRegionDecoderBench_DEFINED |
OLD | NEW |