blob: 528ecabb6b258d3bdf442bcc59585ce12434dc31 [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
11#include "Benchmark.h"
Hal Canary95e3c052017-01-11 12:44:43 -050012#include "SkAutoMalloc.h"
msarett84451022016-02-11 06:45:51 -080013#include "SkData.h"
14#include "SkImageInfo.h"
15#include "SkRefCnt.h"
16#include "SkString.h"
17
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.
38 typedef Benchmark INHERITED;
39};
40#endif // AndroidCodecBench_DEFINED