blob: 4e34276a887cdfb49344deb4d4f27d284e9ca9e4 [file] [log] [blame]
mtkleinfd731ce2014-09-10 12:19:30 -07001/*
2 * Copyright 2014 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 RecordingBench_DEFINED
9#define RecordingBench_DEFINED
10
11#include "Benchmark.h"
12#include "SkPicture.h"
mtklein1d65fe22016-08-10 12:09:34 -070013#include "SkLiteDL.h"
mtkleinfd731ce2014-09-10 12:19:30 -070014
Mike Reed9cdd2ab2016-10-21 10:43:36 -040015class PictureCentricBench : public Benchmark {
mtkleinfd731ce2014-09-10 12:19:30 -070016public:
Mike Reed9cdd2ab2016-10-21 10:43:36 -040017 PictureCentricBench(const char* name, const SkPicture*);
mtkleinfd731ce2014-09-10 12:19:30 -070018
19protected:
mtklein36352bf2015-03-25 18:17:31 -070020 const char* onGetName() override;
21 bool isSuitableFor(Backend) override;
mtklein36352bf2015-03-25 18:17:31 -070022 SkIPoint onGetSize() override;
mtkleinfd731ce2014-09-10 12:19:30 -070023
Mike Reed9cdd2ab2016-10-21 10:43:36 -040024protected:
mtklein8c1a4f82016-08-08 06:56:22 -070025 sk_sp<const SkPicture> fSrc;
mtkleinfd731ce2014-09-10 12:19:30 -070026 SkString fName;
Mike Reed9cdd2ab2016-10-21 10:43:36 -040027
28 typedef Benchmark INHERITED;
29};
30
31class RecordingBench : public PictureCentricBench {
32public:
33 RecordingBench(const char* name, const SkPicture*, bool useBBH, bool lite);
34
35protected:
36 void onDraw(int loops, SkCanvas*) override;
37
38private:
mtklein1d65fe22016-08-10 12:09:34 -070039 sk_sp<SkLiteDL> fDL;
mtkleinfd731ce2014-09-10 12:19:30 -070040 bool fUseBBH;
mtkleinfd731ce2014-09-10 12:19:30 -070041
Mike Reed9cdd2ab2016-10-21 10:43:36 -040042 typedef PictureCentricBench INHERITED;
43};
44
45class PipingBench : public PictureCentricBench {
46public:
47 PipingBench(const char* name, const SkPicture*);
48
49protected:
50 void onDraw(int loops, SkCanvas*) override;
51
52private:
53 typedef PictureCentricBench INHERITED;
mtkleinfd731ce2014-09-10 12:19:30 -070054};
55
56#endif//RecordingBench_DEFINED