blob: 56a08e510ea1c6365e073514f9701fd30ff76b18 [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
Mike Reede45ff462017-12-06 10:47:03 -050045class DeserializePictureBench : public Benchmark {
46public:
47 DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture);
48
49protected:
50 const char* onGetName() override;
51 bool isSuitableFor(Backend) override;
52 SkIPoint onGetSize() override;
53 void onDraw(int loops, SkCanvas*) override;
54
55private:
56 SkString fName;
57 sk_sp<SkData> fEncodedPicture;
58
59 typedef Benchmark INHERITED;
60};
61
mtkleinfd731ce2014-09-10 12:19:30 -070062#endif//RecordingBench_DEFINED