Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: tools/VisualBench/VisualStreamTimingModule.cpp

Issue 1441073005: Fix visualbench flicker on triple buffered platforms (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_continuous_timing
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 DEFINE_bool(reset, true, "Reset the GL context between samples."); 12 DEFINE_bool(reset, true, "Reset the GL context between samples.");
13 13
14 VisualStreamTimingModule::VisualStreamTimingModule(VisualBench* owner) 14 VisualStreamTimingModule::VisualStreamTimingModule(VisualBench* owner)
15 : fInitState(kReset_InitState) 15 : fInitState(kReset_InitState)
16 , fOwner(owner) { 16 , fOwner(owner) {
17 fBenchmarkStream.reset(new VisualBenchmarkStream(owner->getSurfaceProps())); 17 fBenchmarkStream.reset(new VisualBenchmarkStream(owner->getSurfaceProps()));
18 } 18 }
19 19
20 inline void VisualStreamTimingModule::handleInitState(SkCanvas* canvas) { 20 inline void VisualStreamTimingModule::handleInitState(SkCanvas* canvas) {
21 switch (fInitState) { 21 switch (fInitState) {
22 case kNewBenchmark_InitState: 22 case kNewBenchmark_InitState:
23 fBenchmarkStream->current()->delayedSetup(); 23 fBenchmarkStream->current()->delayedSetup();
24 // fallthrough 24 // fallthrough
25 case kReset_InitState: 25 case kReset_InitState:
26 // This will flicker unfortunately, but as we are reseting the GLCon text each bench, 26 // This will flicker unfortunately, but as we are reseting the GLCon text each bench,
27 // we unfortunately don't have a choice 27 // we unfortunately don't have a choice
28 fOwner->clear(canvas, SK_ColorWHITE, 2); 28 fOwner->clear(canvas, SK_ColorWHITE, 3);
29 fBenchmarkStream->current()->preTimingHooks(canvas); 29 fBenchmarkStream->current()->preTimingHooks(canvas);
30 break; 30 break;
31 case kNone_InitState: 31 case kNone_InitState:
32 break; 32 break;
33 } 33 }
34 fInitState = kNone_InitState; 34 fInitState = kNone_InitState;
35 } 35 }
36 36
37 inline void VisualStreamTimingModule::handleTimingEvent(SkCanvas* canvas, 37 inline void VisualStreamTimingModule::handleTimingEvent(SkCanvas* canvas,
38 TimingStateMachine::Pare ntEvents event) { 38 TimingStateMachine::Pare ntEvents event) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // TODO research why this does happen on mac 70 // TODO research why this does happen on mac
71 return; 71 return;
72 } 72 }
73 73
74 this->handleInitState(canvas); 74 this->handleInitState(canvas);
75 this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops()); 75 this->renderFrame(canvas, fBenchmarkStream->current(), fTSM.loops());
76 fOwner->present(); 76 fOwner->present();
77 TimingStateMachine::ParentEvents event = fTSM.nextFrame(FLAGS_reset); 77 TimingStateMachine::ParentEvents event = fTSM.nextFrame(FLAGS_reset);
78 this->handleTimingEvent(canvas, event); 78 this->handleTimingEvent(canvas, event);
79 } 79 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698