2 * Copyright 2015 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef BitmapRegionDecoderBench_DEFINED
9 #define BitmapRegionDecoderBench_DEFINED
11 #include "Benchmark.h"
12 #include "SkBitmapRegionDecoder.h"
14 #include "SkImageInfo.h"
19 * Benchmark Android's BitmapRegionDecoder for a particular colorType, sampleSize, and subset.
21 * fStrategy determines which of various implementations is to be used.
23 * nanobench.cpp handles creating benchmarks for interesting scaled subsets. We strive to test
26 class BitmapRegionDecoderBench : public Benchmark {
28 // Calls encoded->ref()
29 BitmapRegionDecoderBench(const char* basename, SkData* encoded,
30 SkBitmapRegionDecoder::Strategy strategy, SkColorType colorType,
31 uint32_t sampleSize, const SkIRect& subset);
34 const char* onGetName() override;
35 bool isSuitableFor(Backend backend) override;
36 void onDraw(int n, SkCanvas* canvas) override;
37 void onDelayedSetup() override;
41 SkAutoTDelete<SkBitmapRegionDecoder> fBRD;
42 SkAutoTUnref<SkData> fData;
43 const SkBitmapRegionDecoder::Strategy fStrategy;
44 const SkColorType fColorType;
45 const uint32_t fSampleSize;
46 const SkIRect fSubset;
47 typedef Benchmark INHERITED;
49 #endif // BitmapRegionDecoderBench_DEFINED