| 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); | 
| 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             fOwner->clear(canvas, SK_ColorWHITE, 2); |  | 
| 23             fBenchmarkStream->current()->delayedSetup(); | 22             fBenchmarkStream->current()->delayedSetup(); | 
| 24             // fallthrough | 23             // fallthrough | 
| 25         case kReset_InitState: | 24         case kReset_InitState: | 
|  | 25             // This will flicker unfortunately, but as we are reseting the GLCon
    text each bench, | 
|  | 26             // we unfortunately don't have a choice | 
|  | 27             fOwner->clear(canvas, SK_ColorWHITE, 2); | 
| 26             fBenchmarkStream->current()->preTimingHooks(canvas); | 28             fBenchmarkStream->current()->preTimingHooks(canvas); | 
| 27             break; | 29             break; | 
| 28         case kNone_InitState: | 30         case kNone_InitState: | 
| 29             break; | 31             break; | 
| 30     } | 32     } | 
| 31     fInitState = kNone_InitState; | 33     fInitState = kNone_InitState; | 
| 32 } | 34 } | 
| 33 | 35 | 
| 34 inline void VisualStreamTimingModule::handleTimingEvent(SkCanvas* canvas, | 36 inline void VisualStreamTimingModule::handleTimingEvent(SkCanvas* canvas, | 
| 35                                                         TimingStateMachine::Pare
    ntEvents event) { | 37                                                         TimingStateMachine::Pare
    ntEvents event) { | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 66         // TODO research why this does happen on mac | 68         // TODO research why this does happen on mac | 
| 67         return; | 69         return; | 
| 68     } | 70     } | 
| 69 | 71 | 
| 70     this->handleInitState(canvas); | 72     this->handleInitState(canvas); | 
| 71     this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops()); | 73     this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops()); | 
| 72     fOwner->present(); | 74     fOwner->present(); | 
| 73     TimingStateMachine::ParentEvents event = fTSM.nextFrame(fPreWarmBeforeSample
    ); | 75     TimingStateMachine::ParentEvents event = fTSM.nextFrame(fPreWarmBeforeSample
    ); | 
| 74     this->handleTimingEvent(canvas, event); | 76     this->handleTimingEvent(canvas, event); | 
| 75 } | 77 } | 
| OLD | NEW | 
|---|