2015-09-15 14:40:56 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VisualInteractiveModule_DEFINED
|
|
|
|
#define VisualInteractiveModule_DEFINED
|
|
|
|
|
2015-10-14 14:49:28 +00:00
|
|
|
#include "VisualStreamTimingModule.h"
|
2015-09-15 14:40:56 +00:00
|
|
|
|
|
|
|
class SkCanvas;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This module for VisualBench is designed to display stats data dynamically
|
|
|
|
*/
|
2015-10-14 14:49:28 +00:00
|
|
|
class VisualInteractiveModule : public VisualStreamTimingModule {
|
2015-09-15 14:40:56 +00:00
|
|
|
public:
|
|
|
|
// TODO get rid of backpointer
|
|
|
|
VisualInteractiveModule(VisualBench* owner);
|
|
|
|
|
2015-10-14 14:49:28 +00:00
|
|
|
bool onHandleChar(SkUnichar c) override;
|
2015-09-15 14:40:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void drawStats(SkCanvas*);
|
2015-10-14 14:49:28 +00:00
|
|
|
void renderFrame(SkCanvas*, Benchmark*, int loops) override;
|
|
|
|
bool timingFinished(Benchmark*, int loops, double measurement) override;
|
2015-09-15 14:40:56 +00:00
|
|
|
|
|
|
|
static const int kMeasurementCount = 64; // should be power of 2 for fast mod
|
|
|
|
double fMeasurements[kMeasurementCount];
|
|
|
|
int fCurrentMeasurement;
|
2015-10-05 20:24:55 +00:00
|
|
|
bool fAdvance;
|
2015-09-15 14:40:56 +00:00
|
|
|
|
2015-10-14 14:49:28 +00:00
|
|
|
typedef VisualStreamTimingModule INHERITED;
|
2015-09-15 14:40:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|