aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/AndroidCodecBench.h
blob: 8cdd7fec04bb4ee2ca81730b540e2844f94c98bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef AndroidCodecBench_DEFINED
#define AndroidCodecBench_DEFINED

#include "Benchmark.h"
#include "SkData.h"
#include "SkImageInfo.h"
#include "SkRefCnt.h"
#include "SkString.h"

/**
 *  Time SkAndroidCodec.
 */
class AndroidCodecBench : public Benchmark {
public:
    // Calls encoded->ref()
    AndroidCodecBench(SkString basename, SkData* encoded, int sampleSize);

protected:
    const char* onGetName() override;
    bool isSuitableFor(Backend backend) override;
    void onDraw(int n, SkCanvas* canvas) override;
    void onDelayedSetup() override;

private:
    SkString                fName;
    sk_sp<SkData>           fData;
    const int               fSampleSize;
    SkImageInfo             fInfo;          // Set in onDelayedSetup.
    SkAutoMalloc            fPixelStorage;  // Set in onDelayedSetup.
    typedef Benchmark INHERITED;
};
#endif // AndroidCodecBench_DEFINED