184451024bfe06d138629dd7c27cf2ec0f9774dbemsarett/*
284451024bfe06d138629dd7c27cf2ec0f9774dbemsarett * Copyright 2016 Google Inc.
384451024bfe06d138629dd7c27cf2ec0f9774dbemsarett *
484451024bfe06d138629dd7c27cf2ec0f9774dbemsarett * Use of this source code is governed by a BSD-style license that can be
584451024bfe06d138629dd7c27cf2ec0f9774dbemsarett * found in the LICENSE file.
684451024bfe06d138629dd7c27cf2ec0f9774dbemsarett */
784451024bfe06d138629dd7c27cf2ec0f9774dbemsarett
884451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#ifndef AndroidCodecBench_DEFINED
984451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#define AndroidCodecBench_DEFINED
1084451024bfe06d138629dd7c27cf2ec0f9774dbemsarett
1184451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#include "Benchmark.h"
1284451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#include "SkData.h"
1384451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#include "SkImageInfo.h"
1484451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#include "SkRefCnt.h"
1584451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#include "SkString.h"
1684451024bfe06d138629dd7c27cf2ec0f9774dbemsarett
1784451024bfe06d138629dd7c27cf2ec0f9774dbemsarett/**
1884451024bfe06d138629dd7c27cf2ec0f9774dbemsarett *  Time SkAndroidCodec.
1984451024bfe06d138629dd7c27cf2ec0f9774dbemsarett */
2084451024bfe06d138629dd7c27cf2ec0f9774dbemsarettclass AndroidCodecBench : public Benchmark {
2184451024bfe06d138629dd7c27cf2ec0f9774dbemsarettpublic:
2284451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    // Calls encoded->ref()
2384451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    AndroidCodecBench(SkString basename, SkData* encoded, int sampleSize);
2484451024bfe06d138629dd7c27cf2ec0f9774dbemsarett
2584451024bfe06d138629dd7c27cf2ec0f9774dbemsarettprotected:
2684451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    const char* onGetName() override;
2784451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    bool isSuitableFor(Backend backend) override;
2884451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    void onDraw(int n, SkCanvas* canvas) override;
2984451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    void onDelayedSetup() override;
3084451024bfe06d138629dd7c27cf2ec0f9774dbemsarett
3184451024bfe06d138629dd7c27cf2ec0f9774dbemsarettprivate:
3284451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    SkString                fName;
3384451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    SkAutoTUnref<SkData>    fData;
3484451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    const int               fSampleSize;
3584451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    SkImageInfo             fInfo;          // Set in onDelayedSetup.
3684451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    SkAutoMalloc            fPixelStorage;  // Set in onDelayedSetup.
3784451024bfe06d138629dd7c27cf2ec0f9774dbemsarett    typedef Benchmark INHERITED;
3884451024bfe06d138629dd7c27cf2ec0f9774dbemsarett};
3984451024bfe06d138629dd7c27cf2ec0f9774dbemsarett#endif // AndroidCodecBench_DEFINED
40