blob: dc44704ab6bcb5d1bba2e34a21d933be2072b0a7 [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
11#include "Benchmark.h"
Hal Canary95e3c052017-01-11 12:44:43 -050012#include "SkAutoMalloc.h"
scroggo60869a42015-04-01 12:09:17 -070013#include "SkData.h"
14#include "SkImageInfo.h"
15#include "SkRefCnt.h"
16#include "SkString.h"
17
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;
scroggo60869a42015-04-01 12:09:17 -070039 typedef Benchmark INHERITED;
40};
41#endif // CodecBench_DEFINED