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

Side by Side Diff: ui/gfx/animation/tween.cc

Issue 135643006: Fix test failure for 32 bit official build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/gfx/animation/tween.h" 5 #include "ui/gfx/animation/tween.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <float.h> 10 #include <float.h>
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // static 124 // static
125 int Tween::IntValueBetween(double value, int start, int target) { 125 int Tween::IntValueBetween(double value, int start, int target) {
126 if (start == target) 126 if (start == target)
127 return start; 127 return start;
128 double delta = static_cast<double>(target - start); 128 double delta = static_cast<double>(target - start);
129 if (delta < 0) 129 if (delta < 0)
130 delta--; 130 delta--;
131 else 131 else
132 delta++; 132 delta++;
133 #if defined(OS_WIN) 133 #if defined(OS_WIN)
134 return start + static_cast<int>(value * _nextafter(delta, 0)); 134 value *= _nextafter(delta, 0);
135 #else 135 #else
136 return start + static_cast<int>(value * nextafter(delta, 0)); 136 value *= nextafter(delta, 0);
137 #endif 137 #endif
138 return start + static_cast<int>(value);
138 } 139 }
139 140
140 //static 141 //static
141 int Tween::LinearIntValueBetween(double value, int start, int target) { 142 int Tween::LinearIntValueBetween(double value, int start, int target) {
142 return std::floor(0.5 + DoubleValueBetween(value, start, target)); 143 return std::floor(0.5 + DoubleValueBetween(value, start, target));
143 } 144 }
144 145
145 // static 146 // static
146 gfx::Rect Tween::RectValueBetween(double value, 147 gfx::Rect Tween::RectValueBetween(double value,
147 const gfx::Rect& start_bounds, 148 const gfx::Rect& start_bounds,
(...skipping 16 matching lines...) Expand all
164 if (value <= 0.0) 165 if (value <= 0.0)
165 return start_transform; 166 return start_transform;
166 167
167 gfx::Transform to_return = end_transform; 168 gfx::Transform to_return = end_transform;
168 to_return.Blend(start_transform, value); 169 to_return.Blend(start_transform, value);
169 170
170 return to_return; 171 return to_return;
171 } 172 }
172 173
173 } // namespace gfx 174 } // namespace gfx
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