blob: 7b8188df64c36a6d0bb63d0a702d142d167bf42f [file] [log] [blame]
scroggo60869a42015-04-01 12:09:17 -07001/*
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#ifndef CodecBench_DEFINED
9#define CodecBench_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#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"
scroggo60869a42015-04-01 12:09:17 -070017
18/**
19 * Time SkCodec.
20 */
21class CodecBench : public Benchmark {
22public:
23 // Calls encoded->ref()
msarettc7796b92016-01-07 14:20:20 -080024 CodecBench(SkString basename, SkData* encoded, SkColorType colorType, SkAlphaType alphaType);
scroggo60869a42015-04-01 12:09:17 -070025
26protected:
27 const char* onGetName() override;
28 bool isSuitableFor(Backend backend) override;
mtkleina1ebeb22015-10-01 09:43:39 -070029 void onDraw(int n, SkCanvas* canvas) override;
joshualitt8a6697a2015-09-30 12:11:07 -070030 void onDelayedSetup() override;
scroggo60869a42015-04-01 12:09:17 -070031
32private:
33 SkString fName;
34 const SkColorType fColorType;
msarettc7796b92016-01-07 14:20:20 -080035 const SkAlphaType fAlphaType;
bungemanffae30d2016-08-03 13:32:32 -070036 sk_sp<SkData> fData;
msarettc7796b92016-01-07 14:20:20 -080037 SkImageInfo fInfo; // Set in onDelayedSetup.
scroggo21027992015-04-02 13:22:38 -070038 SkAutoMalloc fPixelStorage;
John Stiles7571f9e2020-09-02 22:42:33 -040039 using INHERITED = Benchmark;
scroggo60869a42015-04-01 12:09:17 -070040};
41#endif // CodecBench_DEFINED