blob: d4f8f69b1e8784623779d0c28409f2dea151247b [file] [log] [blame]
jvanverthf5d1b2d2015-09-15 07:40:56 -07001/*
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.
jvanverthf5d1b2d2015-09-15 07:40:56 -07006 */
7
8#ifndef VisualInteractiveModule_DEFINED
9#define VisualInteractiveModule_DEFINED
10
joshualittd0f0bce2015-10-14 07:49:28 -070011#include "VisualStreamTimingModule.h"
jvanverthf5d1b2d2015-09-15 07:40:56 -070012
13class SkCanvas;
14
15/*
16 * This module for VisualBench is designed to display stats data dynamically
17 */
joshualittd0f0bce2015-10-14 07:49:28 -070018class VisualInteractiveModule : public VisualStreamTimingModule {
jvanverthf5d1b2d2015-09-15 07:40:56 -070019public:
20 // TODO get rid of backpointer
21 VisualInteractiveModule(VisualBench* owner);
22
joshualittd0f0bce2015-10-14 07:49:28 -070023 bool onHandleChar(SkUnichar c) override;
jvanverthf5d1b2d2015-09-15 07:40:56 -070024
25private:
jvanverthf5d1b2d2015-09-15 07:40:56 -070026 void drawStats(SkCanvas*);
joshualittd0f0bce2015-10-14 07:49:28 -070027 void renderFrame(SkCanvas*, Benchmark*, int loops) override;
28 bool timingFinished(Benchmark*, int loops, double measurement) override;
jvanverthf5d1b2d2015-09-15 07:40:56 -070029
30 static const int kMeasurementCount = 64; // should be power of 2 for fast mod
31 double fMeasurements[kMeasurementCount];
32 int fCurrentMeasurement;
joshualittdc5db592015-10-05 13:24:55 -070033 bool fAdvance;
jvanverthf5d1b2d2015-09-15 07:40:56 -070034
joshualittd0f0bce2015-10-14 07:49:28 -070035 typedef VisualStreamTimingModule INHERITED;
jvanverthf5d1b2d2015-09-15 07:40:56 -070036};
37
38#endif