| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 * | |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #ifndef VisualInteractiveModule_DEFINED | 8 #ifndef VisualInteractiveModule_DEFINED |
| 10 #define VisualInteractiveModule_DEFINED | 9 #define VisualInteractiveModule_DEFINED |
| 11 | 10 |
| 12 #include "VisualModule.h" | 11 #include "VisualStreamTimingModule.h" |
| 13 | |
| 14 #include "ResultsWriter.h" | |
| 15 #include "SkPicture.h" | |
| 16 #include "Timer.h" | |
| 17 #include "TimingStateMachine.h" | |
| 18 #include "VisualBench.h" | |
| 19 #include "VisualBenchmarkStream.h" | |
| 20 | 12 |
| 21 class SkCanvas; | 13 class SkCanvas; |
| 22 | 14 |
| 23 /* | 15 /* |
| 24 * This module for VisualBench is designed to display stats data dynamically | 16 * This module for VisualBench is designed to display stats data dynamically |
| 25 */ | 17 */ |
| 26 class VisualInteractiveModule : public VisualModule { | 18 class VisualInteractiveModule : public VisualStreamTimingModule { |
| 27 public: | 19 public: |
| 28 // TODO get rid of backpointer | 20 // TODO get rid of backpointer |
| 29 VisualInteractiveModule(VisualBench* owner); | 21 VisualInteractiveModule(VisualBench* owner); |
| 30 | 22 |
| 31 void draw(SkCanvas* canvas) override; | 23 bool onHandleChar(SkUnichar c) override; |
| 32 bool onHandleChar(SkUnichar unichar) override; | |
| 33 | 24 |
| 34 private: | 25 private: |
| 35 void setTitle(); | |
| 36 bool setupBackend(); | |
| 37 void setupRenderTarget(); | |
| 38 void drawStats(SkCanvas*); | 26 void drawStats(SkCanvas*); |
| 39 bool advanceRecordIfNecessary(SkCanvas*); | 27 void renderFrame(SkCanvas*, Benchmark*, int loops) override; |
| 40 inline void renderFrame(SkCanvas*); | 28 bool timingFinished(Benchmark*, int loops, double measurement) override; |
| 41 | 29 |
| 42 static const int kMeasurementCount = 64; // should be power of 2 for fast m
od | 30 static const int kMeasurementCount = 64; // should be power of 2 for fast m
od |
| 43 double fMeasurements[kMeasurementCount]; | 31 double fMeasurements[kMeasurementCount]; |
| 44 int fCurrentMeasurement; | 32 int fCurrentMeasurement; |
| 33 bool fAdvance; |
| 45 | 34 |
| 46 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream; | 35 typedef VisualStreamTimingModule INHERITED; |
| 47 SkAutoTUnref<Benchmark> fBenchmark; | |
| 48 TimingStateMachine fTSM; | |
| 49 bool fAdvance; | |
| 50 bool fHasBeenReset; | |
| 51 | |
| 52 // support framework | |
| 53 SkAutoTUnref<VisualBench> fOwner; | |
| 54 | |
| 55 typedef VisualModule INHERITED; | |
| 56 }; | 36 }; |
| 57 | 37 |
| 58 #endif | 38 #endif |
| OLD | NEW |