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
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
#include "Benchmark.h"
|
2014-02-03 14:48:17 +00:00
|
|
|
#include "SkCanvas.h"
|
2014-06-19 19:32:29 +00:00
|
|
|
#include "gm.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);
|
|
|
|
virtual ~GMBench();
|
2014-02-03 14:48:17 +00:00
|
|
|
|
|
|
|
protected:
|
2015-01-09 18:06:39 +00:00
|
|
|
const char* onGetName() SK_OVERRIDE;
|
|
|
|
bool isSuitableFor(Backend backend) SK_OVERRIDE;
|
|
|
|
void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
SkIPoint onGetSize() SK_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
|