aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/AndroidCodecBench.h
blob: fdbec5258a8b102affe6a3fa5a9fd5f83cb7d0b3 (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;
    SkAutoTUnref<SkData>    fData;
    const int               fSampleSize;
    SkImageInfo             fInfo;          // Set in onDelayedSetup.
    SkAutoMalloc            fPixelStorage;  // Set in onDelayedSetup.
    typedef Benchmark INHERITED;
};
#endif // AndroidCodecBench_DEFINED