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