Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
BitmapRegionDecoderBench.h
Go to the documentation of this file.
1/*
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
8#ifndef BitmapRegionDecoderBench_DEFINED
9#define BitmapRegionDecoderBench_DEFINED
10
11#include "bench/Benchmark.h"
12#ifdef SK_ENABLE_ANDROID_UTILS
13#include "include/core/SkData.h"
17
18namespace android {
19namespace skia {
20class BitmapRegionDecoder;
21} // namespace skia
22} // namespace android
23
24/**
25 * Benchmark Android's BitmapRegionDecoder for a particular colorType, sampleSize, and subset.
26 *
27 * nanobench.cpp handles creating benchmarks for interesting scaled subsets. We strive to test
28 * on real use cases.
29 */
30class BitmapRegionDecoderBench : public Benchmark {
31public:
32 // Calls encoded->ref()
33 BitmapRegionDecoderBench(const char* basename, SkData* encoded, SkColorType colorType,
34 uint32_t sampleSize, const SkIRect& subset);
35
36protected:
37 const char* onGetName() override;
38 bool isSuitableFor(Backend backend) override;
39 void onDraw(int n, SkCanvas* canvas) override;
40 void onDelayedSetup() override;
41
42private:
44 std::unique_ptr<android::skia::BitmapRegionDecoder> fBRD;
45 sk_sp<SkData> fData;
47 const uint32_t fSampleSize;
48 const SkIRect fSubset;
49 using INHERITED = Benchmark;
50};
51#endif // SK_ENABLE_ANDROID_UTILS
52#endif // BitmapRegionDecoderBench_DEFINED
const char * fName
SkColorType fColorType
SkColorType
Definition SkColorType.h:19
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
#define INHERITED(method,...)
virtual void onDraw(int loops, SkCanvas *)=0
virtual bool isSuitableFor(Backend backend)
Definition Benchmark.h:55
virtual void onDelayedSetup()
Definition Benchmark.h:101
virtual const char * onGetName()=0