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

Side by Side Diff: cc/base/math_util.h

Issue 2803853007: Ignore rounding error between clip_layer_length_ and scroll_layer_length_ (Closed)
Patch Set: expose IsFloatNearlyTheSame & add comment Created 3 years, 8 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 | cc/base/math_util.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CC_BASE_MATH_UTIL_H_ 5 #ifndef CC_BASE_MATH_UTIL_H_
6 #define CC_BASE_MATH_UTIL_H_ 6 #define CC_BASE_MATH_UTIL_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <cmath> 9 #include <cmath>
10 #include <memory> 10 #include <memory>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // If the value is inf, returns max double/float representation. 289 // If the value is inf, returns max double/float representation.
290 static double AsDoubleSafely(double value); 290 static double AsDoubleSafely(double value);
291 static float AsFloatSafely(float value); 291 static float AsFloatSafely(float value);
292 292
293 // Returns vector that x axis (1,0,0) transforms to under given transform. 293 // Returns vector that x axis (1,0,0) transforms to under given transform.
294 static gfx::Vector3dF GetXAxis(const gfx::Transform& transform); 294 static gfx::Vector3dF GetXAxis(const gfx::Transform& transform);
295 295
296 // Returns vector that y axis (0,1,0) transforms to under given transform. 296 // Returns vector that y axis (0,1,0) transforms to under given transform.
297 static gfx::Vector3dF GetYAxis(const gfx::Transform& transform); 297 static gfx::Vector3dF GetYAxis(const gfx::Transform& transform);
298 298
299 static bool IsNearlyTheSameForTesting(float left, float right); 299 static bool IsFloatNearlyTheSame(float left, float right);
300 static bool IsNearlyTheSameForTesting(const gfx::PointF& l, 300 static bool IsNearlyTheSameForTesting(const gfx::PointF& l,
301 const gfx::PointF& r); 301 const gfx::PointF& r);
302 static bool IsNearlyTheSameForTesting(const gfx::Point3F& l, 302 static bool IsNearlyTheSameForTesting(const gfx::Point3F& l,
303 const gfx::Point3F& r); 303 const gfx::Point3F& r);
304 304
305 private: 305 private:
306 template <typename T> 306 template <typename T>
307 static T RoundUpInternal(T n, T mul) { 307 static T RoundUpInternal(T n, T mul) {
308 return (n > 0) ? ((n + mul - 1) / mul) * mul : (n / mul) * mul; 308 return (n > 0) ? ((n + mul - 1) / mul) * mul : (n / mul) * mul;
309 } 309 }
(...skipping 13 matching lines...) Expand all
323 private: 323 private:
324 #ifdef __SSE__ 324 #ifdef __SSE__
325 unsigned int orig_state_; 325 unsigned int orig_state_;
326 #endif 326 #endif
327 DISALLOW_COPY_AND_ASSIGN(ScopedSubnormalFloatDisabler); 327 DISALLOW_COPY_AND_ASSIGN(ScopedSubnormalFloatDisabler);
328 }; 328 };
329 329
330 } // namespace cc 330 } // namespace cc
331 331
332 #endif // CC_BASE_MATH_UTIL_H_ 332 #endif // CC_BASE_MATH_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | cc/base/math_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698