msarett | 8445102 | 2016-02-11 06:45:51 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 AndroidCodecBench_DEFINED |
| 9 | #define AndroidCodecBench_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "bench/Benchmark.h" |
| 12 | #include "include/core/SkData.h" |
| 13 | #include "include/core/SkImageInfo.h" |
| 14 | #include "include/core/SkRefCnt.h" |
| 15 | #include "include/core/SkString.h" |
| 16 | #include "src/core/SkAutoMalloc.h" |
msarett | 8445102 | 2016-02-11 06:45:51 -0800 | [diff] [blame] | 17 | |
| 18 | /** |
| 19 | * Time SkAndroidCodec. |
| 20 | */ |
| 21 | class AndroidCodecBench : public Benchmark { |
| 22 | public: |
| 23 | // Calls encoded->ref() |
| 24 | AndroidCodecBench(SkString basename, SkData* encoded, int sampleSize); |
| 25 | |
| 26 | protected: |
| 27 | const char* onGetName() override; |
| 28 | bool isSuitableFor(Backend backend) override; |
| 29 | void onDraw(int n, SkCanvas* canvas) override; |
| 30 | void onDelayedSetup() override; |
| 31 | |
| 32 | private: |
| 33 | SkString fName; |
bungeman | ffae30d | 2016-08-03 13:32:32 -0700 | [diff] [blame] | 34 | sk_sp<SkData> fData; |
msarett | 8445102 | 2016-02-11 06:45:51 -0800 | [diff] [blame] | 35 | const int fSampleSize; |
| 36 | SkImageInfo fInfo; // Set in onDelayedSetup. |
| 37 | SkAutoMalloc fPixelStorage; // Set in onDelayedSetup. |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 38 | using INHERITED = Benchmark; |
msarett | 8445102 | 2016-02-11 06:45:51 -0800 | [diff] [blame] | 39 | }; |
| 40 | #endif // AndroidCodecBench_DEFINED |