2014-02-03 14:48:17 +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.
|
|
|
|
*/
|
2014-08-01 14:46:52 +00:00
|
|
|
#ifndef GMBench_DEFINED
|
|
|
|
#define GMBench_DEFINED
|
2014-02-03 14:48:17 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "bench/Benchmark.h"
|
|
|
|
#include "gm/gm.h"
|
|
|
|
#include "include/core/SkCanvas.h"
|
2014-02-03 14:48:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs a GM as a benchmark by repeatedly drawing the GM.
|
|
|
|
*/
|
2014-06-19 19:32:29 +00:00
|
|
|
class GMBench : public Benchmark {
|
2014-02-03 14:48:17 +00:00
|
|
|
public:
|
|
|
|
// Constructor takes ownership of the GM param.
|
2014-06-19 19:32:29 +00:00
|
|
|
GMBench(skiagm::GM* gm);
|
2017-03-22 16:05:03 +00:00
|
|
|
~GMBench() override;
|
2014-02-03 14:48:17 +00:00
|
|
|
|
2017-10-11 19:34:27 +00:00
|
|
|
void modifyGrContextOptions(GrContextOptions* options) override {
|
|
|
|
return fGM->modifyGrContextOptions(options);
|
|
|
|
}
|
|
|
|
|
2014-02-03 14:48:17 +00:00
|
|
|
protected:
|
2015-03-26 01:17:31 +00:00
|
|
|
const char* onGetName() override;
|
|
|
|
bool isSuitableFor(Backend backend) override;
|
2015-10-01 16:43:39 +00:00
|
|
|
void onDraw(int loops, SkCanvas* canvas) override;
|
2015-03-26 01:17:31 +00:00
|
|
|
SkIPoint onGetSize() override;
|
2014-02-03 14:48:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
skiagm::GM* fGM;
|
|
|
|
SkString fName;
|
2014-06-19 19:32:29 +00:00
|
|
|
typedef Benchmark INHERITED;
|
2014-02-03 14:48:17 +00:00
|
|
|
};
|
2014-08-01 14:46:52 +00:00
|
|
|
|
|
|
|
#endif
|