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

Side by Side Diff: app/slide_animation.cc

Issue 5574006: Start deinlining non-empty virtual methods. (This will be automatically checked (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove virtual from VideoFrame::type() Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « app/slide_animation.h ('k') | app/throb_animation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "app/slide_animation.h" 5 #include "app/slide_animation.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 // How many frames per second to target. 9 // How many frames per second to target.
10 static const int kDefaultFramerateHz = 50; 10 static const int kDefaultFramerateHz = 50;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return; 73 return;
74 } else if (value_current_ == value_end_) { 74 } else if (value_current_ == value_end_) {
75 return; 75 return;
76 } 76 }
77 77
78 // This will also reset the currently-occuring animation. 78 // This will also reset the currently-occuring animation.
79 SetDuration(static_cast<int>(slide_duration_ * value_current_)); 79 SetDuration(static_cast<int>(slide_duration_ * value_current_));
80 Start(); 80 Start();
81 } 81 }
82 82
83 void SlideAnimation::SetSlideDuration(int duration) {
84 slide_duration_ = duration;
85 }
86
87 double SlideAnimation::GetCurrentValue() const {
88 return value_current_;
89 }
90
83 void SlideAnimation::AnimateToState(double state) { 91 void SlideAnimation::AnimateToState(double state) {
84 if (state > 1.0) 92 if (state > 1.0)
85 state = 1.0; 93 state = 1.0;
86 94
87 state = Tween::CalculateValue(tween_type_, state); 95 state = Tween::CalculateValue(tween_type_, state);
88 96
89 value_current_ = value_start_ + (value_end_ - value_start_) * state; 97 value_current_ = value_start_ + (value_end_ - value_start_) * state;
90 98
91 // Implement snapping. 99 // Implement snapping.
92 if (tween_type_ == Tween::EASE_OUT_SNAP && 100 if (tween_type_ == Tween::EASE_OUT_SNAP &&
93 fabs(value_current_ - value_end_) <= 0.06) 101 fabs(value_current_ - value_end_) <= 0.06)
94 value_current_ = value_end_; 102 value_current_ = value_end_;
95 103
96 // Correct for any overshoot (while state may be capped at 1.0, let's not 104 // Correct for any overshoot (while state may be capped at 1.0, let's not
97 // take any rounding error chances. 105 // take any rounding error chances.
98 if ((value_end_ >= value_start_ && value_current_ > value_end_) || 106 if ((value_end_ >= value_start_ && value_current_ > value_end_) ||
99 (value_end_ < value_start_ && value_current_ < value_end_)) { 107 (value_end_ < value_start_ && value_current_ < value_end_)) {
100 value_current_ = value_end_; 108 value_current_ = value_end_;
101 } 109 }
102 } 110 }
OLDNEW
« no previous file with comments | « app/slide_animation.h ('k') | app/throb_animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698