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-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:
|
|
|
|
virtual const char* onGetName() SK_OVERRIDE;
|
|
|
|
virtual bool isSuitableFor(Backend backend) SK_OVERRIDE;
|
|
|
|
virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE;
|
|
|
|
virtual SkIPoint onGetSize() SK_OVERRIDE;
|
|
|
|
|
|
|
|
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
|
|
|
};
|