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 "bench/Benchmark.h" 12 #include "include/core/SkPicture.h" 13 14 class PictureCentricBench : public Benchmark { 15 public: 16 PictureCentricBench(const char* name, const SkPicture*); 17 18 protected: 19 const char* onGetName() override; 20 bool isSuitableFor(Backend) override; 21 SkIPoint onGetSize() override; 22 23 protected: 24 sk_sp<const SkPicture> fSrc; 25 SkString fName; 26 27 typedef Benchmark INHERITED; 28 }; 29 30 class RecordingBench : public PictureCentricBench { 31 public: 32 RecordingBench(const char* name, const SkPicture*, bool useBBH); 33 34 protected: 35 void onDraw(int loops, SkCanvas*) override; 36 37 private: 38 bool fUseBBH; 39 40 typedef PictureCentricBench INHERITED; 41 }; 42 43 class DeserializePictureBench : public Benchmark { 44 public: 45 DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture); 46 47 protected: 48 const char* onGetName() override; 49 bool isSuitableFor(Backend) override; 50 SkIPoint onGetSize() override; 51 void onDraw(int loops, SkCanvas*) override; 52 53 private: 54 SkString fName; 55 sk_sp<SkData> fEncodedPicture; 56 57 typedef Benchmark INHERITED; 58 }; 59 60 #endif//RecordingBench_DEFINED 61