| 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 */ | 6 */ |
| 7 | 7 |
| 8 #include "VisualStreamTimingModule.h" | 8 #include "VisualStreamTimingModule.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 | 11 |
| 12 VisualStreamTimingModule::VisualStreamTimingModule(VisualBench* owner, bool preW
armBeforeSample) | 12 VisualStreamTimingModule::VisualStreamTimingModule(VisualBench* owner, bool preW
armBeforeSample) |
| 13 : fInitState(kReset_InitState) | 13 : fInitState(kReset_InitState) |
| 14 , fPreWarmBeforeSample(preWarmBeforeSample) | 14 , fPreWarmBeforeSample(preWarmBeforeSample) |
| 15 , fOwner(owner) { | 15 , fOwner(owner) { |
| 16 fBenchmarkStream.reset(new VisualBenchmarkStream); | 16 fBenchmarkStream.reset(new VisualBenchmarkStream(owner->getSurfaceProps())); |
| 17 } | 17 } |
| 18 | 18 |
| 19 inline void VisualStreamTimingModule::handleInitState(SkCanvas* canvas) { | 19 inline void VisualStreamTimingModule::handleInitState(SkCanvas* canvas) { |
| 20 switch (fInitState) { | 20 switch (fInitState) { |
| 21 case kNewBenchmark_InitState: | 21 case kNewBenchmark_InitState: |
| 22 fBenchmarkStream->current()->delayedSetup(); | 22 fBenchmarkStream->current()->delayedSetup(); |
| 23 // fallthrough | 23 // fallthrough |
| 24 case kReset_InitState: | 24 case kReset_InitState: |
| 25 // This will flicker unfortunately, but as we are reseting the GLCon
text each bench, | 25 // This will flicker unfortunately, but as we are reseting the GLCon
text each bench, |
| 26 // we unfortunately don't have a choice | 26 // we unfortunately don't have a choice |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // TODO research why this does happen on mac | 68 // TODO research why this does happen on mac |
| 69 return; | 69 return; |
| 70 } | 70 } |
| 71 | 71 |
| 72 this->handleInitState(canvas); | 72 this->handleInitState(canvas); |
| 73 this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops()); | 73 this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops()); |
| 74 fOwner->present(); | 74 fOwner->present(); |
| 75 TimingStateMachine::ParentEvents event = fTSM.nextFrame(fPreWarmBeforeSample
); | 75 TimingStateMachine::ParentEvents event = fTSM.nextFrame(fPreWarmBeforeSample
); |
| 76 this->handleTimingEvent(canvas, event); | 76 this->handleTimingEvent(canvas, event); |
| 77 } | 77 } |
| OLD | NEW |