commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 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 | */ |
mtklein | 9200758 | 2014-08-01 07:46:52 -0700 | [diff] [blame] | 7 | #ifndef GMBench_DEFINED |
| 8 | #define GMBench_DEFINED |
commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 9 | |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 10 | #include "Benchmark.h" |
commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 11 | #include "SkCanvas.h" |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 12 | #include "gm.h" |
commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 13 | |
| 14 | /** |
| 15 | * Runs a GM as a benchmark by repeatedly drawing the GM. |
| 16 | */ |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 17 | class GMBench : public Benchmark { |
commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 18 | public: |
| 19 | // Constructor takes ownership of the GM param. |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 20 | GMBench(skiagm::GM* gm); |
| 21 | virtual ~GMBench(); |
commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 22 | |
| 23 | protected: |
| 24 | virtual const char* onGetName() SK_OVERRIDE; |
| 25 | virtual bool isSuitableFor(Backend backend) SK_OVERRIDE; |
| 26 | virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE; |
| 27 | virtual SkIPoint onGetSize() SK_OVERRIDE; |
| 28 | |
| 29 | private: |
| 30 | skiagm::GM* fGM; |
| 31 | SkString fName; |
tfarina | f168b86 | 2014-06-19 12:32:29 -0700 | [diff] [blame] | 32 | typedef Benchmark INHERITED; |
commit-bot@chromium.org | 6adce67 | 2014-02-03 14:48:17 +0000 | [diff] [blame] | 33 | }; |
mtklein | 9200758 | 2014-08-01 07:46:52 -0700 | [diff] [blame] | 34 | |
| 35 | #endif |