blob: 5b4db240049c29b44cea70bf6b9cd55ad565fbfd [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"
scroggo60869a42015-04-01 12:09:17 -070012#include "SkData.h"
13#include "SkImageInfo.h"
14#include "SkRefCnt.h"
15#include "SkString.h"
16
17/**
18 * Time SkCodec.
19 */
20class CodecBench : public Benchmark {
21public:
22 // Calls encoded->ref()
msarettc7796b92016-01-07 14:20:20 -080023 CodecBench(SkString basename, SkData* encoded, SkColorType colorType, SkAlphaType alphaType);
scroggo60869a42015-04-01 12:09:17 -070024
25protected:
26 const char* onGetName() override;
27 bool isSuitableFor(Backend backend) override;
mtkleina1ebeb22015-10-01 09:43:39 -070028 void onDraw(int n, SkCanvas* canvas) override;
joshualitt8a6697a2015-09-30 12:11:07 -070029 void onDelayedSetup() override;
scroggo60869a42015-04-01 12:09:17 -070030
31private:
32 SkString fName;
33 const SkColorType fColorType;
msarettc7796b92016-01-07 14:20:20 -080034 const SkAlphaType fAlphaType;
bungemanffae30d2016-08-03 13:32:32 -070035 sk_sp<SkData> fData;
msarettc7796b92016-01-07 14:20:20 -080036 SkImageInfo fInfo; // Set in onDelayedSetup.
scroggo21027992015-04-02 13:22:38 -070037 SkAutoMalloc fPixelStorage;
scroggo60869a42015-04-01 12:09:17 -070038 typedef Benchmark INHERITED;
39};
40#endif // CodecBench_DEFINED