blob: 751223d04e5350359b98ac986a58b76faa0ac762 [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:
Derek Sollenbergerd7875f52017-03-01 15:33:23 -050039 std::unique_ptr<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
Mike Reede45ff462017-12-06 10:47:03 -050056class DeserializePictureBench : public Benchmark {
57public:
58 DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture);
59
60protected:
61 const char* onGetName() override;
62 bool isSuitableFor(Backend) override;
63 SkIPoint onGetSize() override;
64 void onDraw(int loops, SkCanvas*) override;
65
66private:
67 SkString fName;
68 sk_sp<SkData> fEncodedPicture;
69
70 typedef Benchmark INHERITED;
71};
72
mtkleinfd731ce2014-09-10 12:19:30 -070073#endif//RecordingBench_DEFINED