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" 13#include "SkLiteDL.h" 14 15class PictureCentricBench : public Benchmark { 16public: 17 PictureCentricBench(const char* name, const SkPicture*); 18 19protected: 20 const char* onGetName() override; 21 bool isSuitableFor(Backend) override; 22 SkIPoint onGetSize() override; 23 24protected: 25 sk_sp<const SkPicture> fSrc; 26 SkString fName; 27 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: 39 std::unique_ptr<SkLiteDL> fDL; 40 bool fUseBBH; 41 42 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; 54}; 55 56class 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 73#endif//RecordingBench_DEFINED 74