mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 1 | /* |
| 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" |
mtklein | 1d65fe2 | 2016-08-10 12:09:34 -0700 | [diff] [blame] | 13 | #include "SkLiteDL.h" |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 14 | |
Mike Reed | 9cdd2ab | 2016-10-21 10:43:36 -0400 | [diff] [blame] | 15 | class PictureCentricBench : public Benchmark { |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 16 | public: |
Mike Reed | 9cdd2ab | 2016-10-21 10:43:36 -0400 | [diff] [blame] | 17 | PictureCentricBench(const char* name, const SkPicture*); |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 18 | |
| 19 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 20 | const char* onGetName() override; |
| 21 | bool isSuitableFor(Backend) override; |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 22 | SkIPoint onGetSize() override; |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 23 | |
Mike Reed | 9cdd2ab | 2016-10-21 10:43:36 -0400 | [diff] [blame] | 24 | protected: |
mtklein | 8c1a4f8 | 2016-08-08 06:56:22 -0700 | [diff] [blame] | 25 | sk_sp<const SkPicture> fSrc; |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 26 | SkString fName; |
Mike Reed | 9cdd2ab | 2016-10-21 10:43:36 -0400 | [diff] [blame] | 27 | |
| 28 | typedef Benchmark INHERITED; |
| 29 | }; |
| 30 | |
| 31 | class RecordingBench : public PictureCentricBench { |
| 32 | public: |
| 33 | RecordingBench(const char* name, const SkPicture*, bool useBBH, bool lite); |
| 34 | |
| 35 | protected: |
| 36 | void onDraw(int loops, SkCanvas*) override; |
| 37 | |
| 38 | private: |
Derek Sollenberger | d7875f5 | 2017-03-01 15:33:23 -0500 | [diff] [blame] | 39 | std::unique_ptr<SkLiteDL> fDL; |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 40 | bool fUseBBH; |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 41 | |
Mike Reed | 9cdd2ab | 2016-10-21 10:43:36 -0400 | [diff] [blame] | 42 | typedef PictureCentricBench INHERITED; |
| 43 | }; |
| 44 | |
Mike Reed | e45ff46 | 2017-12-06 10:47:03 -0500 | [diff] [blame] | 45 | class DeserializePictureBench : public Benchmark { |
| 46 | public: |
| 47 | DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture); |
| 48 | |
| 49 | protected: |
| 50 | const char* onGetName() override; |
| 51 | bool isSuitableFor(Backend) override; |
| 52 | SkIPoint onGetSize() override; |
| 53 | void onDraw(int loops, SkCanvas*) override; |
| 54 | |
| 55 | private: |
| 56 | SkString fName; |
| 57 | sk_sp<SkData> fEncodedPicture; |
| 58 | |
| 59 | typedef Benchmark INHERITED; |
| 60 | }; |
| 61 | |
mtklein | fd731ce | 2014-09-10 12:19:30 -0700 | [diff] [blame] | 62 | #endif//RecordingBench_DEFINED |