jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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. |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef VisualInteractiveModule_DEFINED |
| 9 | #define VisualInteractiveModule_DEFINED |
| 10 | |
joshualitt | d0f0bce | 2015-10-14 07:49:28 -0700 | [diff] [blame] | 11 | #include "VisualStreamTimingModule.h" |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 12 | |
| 13 | class SkCanvas; |
| 14 | |
| 15 | /* |
| 16 | * This module for VisualBench is designed to display stats data dynamically |
| 17 | */ |
joshualitt | d0f0bce | 2015-10-14 07:49:28 -0700 | [diff] [blame] | 18 | class VisualInteractiveModule : public VisualStreamTimingModule { |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 19 | public: |
| 20 | // TODO get rid of backpointer |
| 21 | VisualInteractiveModule(VisualBench* owner); |
| 22 | |
joshualitt | d0f0bce | 2015-10-14 07:49:28 -0700 | [diff] [blame] | 23 | bool onHandleChar(SkUnichar c) override; |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 24 | |
| 25 | private: |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 26 | void drawStats(SkCanvas*); |
joshualitt | d0f0bce | 2015-10-14 07:49:28 -0700 | [diff] [blame] | 27 | void renderFrame(SkCanvas*, Benchmark*, int loops) override; |
| 28 | bool timingFinished(Benchmark*, int loops, double measurement) override; |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 29 | |
| 30 | static const int kMeasurementCount = 64; // should be power of 2 for fast mod |
| 31 | double fMeasurements[kMeasurementCount]; |
| 32 | int fCurrentMeasurement; |
joshualitt | dc5db59 | 2015-10-05 13:24:55 -0700 | [diff] [blame] | 33 | bool fAdvance; |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 34 | |
joshualitt | d0f0bce | 2015-10-14 07:49:28 -0700 | [diff] [blame] | 35 | typedef VisualStreamTimingModule INHERITED; |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | #endif |