blob: dd2d8aab430b77488378907a854af69c7abbd0d1 [file] [log] [blame]
msarett84451022016-02-11 06:45:51 -08001/*
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 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"
msarett84451022016-02-11 06:45:51 -080017
18/**
19 * Time SkAndroidCodec.
20 */
21class AndroidCodecBench : public Benchmark {
22public:
23 // Calls encoded->ref()
24 AndroidCodecBench(SkString basename, SkData* encoded, int sampleSize);
25
26protected:
27 const char* onGetName() override;
28 bool isSuitableFor(Backend backend) override;
29 void onDraw(int n, SkCanvas* canvas) override;
30 void onDelayedSetup() override;
31
32private:
33 SkString fName;
bungemanffae30d2016-08-03 13:32:32 -070034 sk_sp<SkData> fData;
msarett84451022016-02-11 06:45:51 -080035 const int fSampleSize;
36 SkImageInfo fInfo; // Set in onDelayedSetup.
37 SkAutoMalloc fPixelStorage; // Set in onDelayedSetup.
John Stiles7571f9e2020-09-02 22:42:33 -040038 using INHERITED = Benchmark;
msarett84451022016-02-11 06:45:51 -080039};
40#endif // AndroidCodecBench_DEFINED