2014-09-10 19:19:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RecordingBench_DEFINED
|
|
|
|
#define RecordingBench_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "bench/Benchmark.h"
|
|
|
|
#include "include/core/SkPicture.h"
|
2014-09-10 19:19:30 +00:00
|
|
|
|
2016-10-21 14:43:36 +00:00
|
|
|
class PictureCentricBench : public Benchmark {
|
2014-09-10 19:19:30 +00:00
|
|
|
public:
|
2016-10-21 14:43:36 +00:00
|
|
|
PictureCentricBench(const char* name, const SkPicture*);
|
2014-09-10 19:19:30 +00:00
|
|
|
|
|
|
|
protected:
|
2015-03-26 01:17:31 +00:00
|
|
|
const char* onGetName() override;
|
|
|
|
bool isSuitableFor(Backend) override;
|
|
|
|
SkIPoint onGetSize() override;
|
2014-09-10 19:19:30 +00:00
|
|
|
|
2016-10-21 14:43:36 +00:00
|
|
|
protected:
|
2016-08-08 13:56:22 +00:00
|
|
|
sk_sp<const SkPicture> fSrc;
|
2014-09-10 19:19:30 +00:00
|
|
|
SkString fName;
|
2016-10-21 14:43:36 +00:00
|
|
|
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = Benchmark;
|
2016-10-21 14:43:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RecordingBench : public PictureCentricBench {
|
|
|
|
public:
|
2019-05-14 17:33:40 +00:00
|
|
|
RecordingBench(const char* name, const SkPicture*, bool useBBH);
|
2016-10-21 14:43:36 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void onDraw(int loops, SkCanvas*) override;
|
|
|
|
|
|
|
|
private:
|
2014-09-10 19:19:30 +00:00
|
|
|
bool fUseBBH;
|
|
|
|
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = PictureCentricBench;
|
2016-10-21 14:43:36 +00:00
|
|
|
};
|
|
|
|
|
2017-12-06 15:47:03 +00:00
|
|
|
class DeserializePictureBench : public Benchmark {
|
|
|
|
public:
|
|
|
|
DeserializePictureBench(const char* name, sk_sp<SkData> encodedPicture);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
const char* onGetName() override;
|
|
|
|
bool isSuitableFor(Backend) override;
|
|
|
|
SkIPoint onGetSize() override;
|
|
|
|
void onDraw(int loops, SkCanvas*) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
SkString fName;
|
|
|
|
sk_sp<SkData> fEncodedPicture;
|
|
|
|
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = Benchmark;
|
2017-12-06 15:47:03 +00:00
|
|
|
};
|
|
|
|
|
2014-09-10 19:19:30 +00:00
|
|
|
#endif//RecordingBench_DEFINED
|