blob: a32bfeaa6eb8792f7d36326d0c73d4fc9d67ce5e [file] [log] [blame]
msarett95f192d2015-02-13 09:05:41 -08001/*
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
scroggo60869a42015-04-01 12:09:17 -07008#ifndef DecodingBench_DEFINED
9#define DecodingBench_DEFINED
10
msarett95f192d2015-02-13 09:05:41 -080011#include "Benchmark.h"
scroggo60869a42015-04-01 12:09:17 -070012#include "SkData.h"
msarett95f192d2015-02-13 09:05:41 -080013#include "SkImageDecoder.h"
scroggo60869a42015-04-01 12:09:17 -070014#include "SkRefCnt.h"
msarett95f192d2015-02-13 09:05:41 -080015#include "SkString.h"
16
17/*
18 *
19 * This benchmark is designed to test the performance of image decoding.
20 * It is invoked from the nanobench.cpp file.
21 *
22 */
23class DecodingBench : public Benchmark {
24public:
25 DecodingBench(SkString path, SkColorType colorType);
26
27protected:
mtklein36352bf2015-03-25 18:17:31 -070028 const char* onGetName() override;
29 bool isSuitableFor(Backend backend) override;
30 void onDraw(const int n, SkCanvas* canvas) override;
scroggo60869a42015-04-01 12:09:17 -070031 void onPreDraw() override;
32
msarett95f192d2015-02-13 09:05:41 -080033private:
scroggo60869a42015-04-01 12:09:17 -070034 SkString fName;
35 SkColorType fColorType;
36 SkAutoTUnref<SkData> fData;
scroggo21027992015-04-02 13:22:38 -070037 SkAutoMalloc fPixelStorage;
msarett95f192d2015-02-13 09:05:41 -080038 typedef Benchmark INHERITED;
39};
scroggo60869a42015-04-01 12:09:17 -070040#endif // DecodingBench_DEFINED