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

Side by Side Diff: ui/gfx/geometry/cubic_bezier.h

Issue 2272303002: Blink Animation: Limit maximum accuracy to avoid hanging for long durations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ 5 #ifndef UI_GFX_GEOMETRY_CUBIC_BEZIER_H_
6 #define UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ 6 #define UI_GFX_GEOMETRY_CUBIC_BEZIER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/gfx/gfx_export.h" 9 #include "ui/gfx/gfx_export.h"
10 10
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 double SampleCurveDerivativeX(double t) const { 27 double SampleCurveDerivativeX(double t) const {
28 return (3.0 * ax_ * t + 2.0 * bx_) * t + cx_; 28 return (3.0 * ax_ * t + 2.0 * bx_) * t + cx_;
29 } 29 }
30 30
31 double SampleCurveDerivativeY(double t) const { 31 double SampleCurveDerivativeY(double t) const {
32 return (3.0 * ay_ * t + 2.0 * by_) * t + cy_; 32 return (3.0 * ay_ * t + 2.0 * by_) * t + cy_;
33 } 33 }
34 34
35 static double GetDefaultEpsilon();
36
35 // Given an x value, find a parametric value it came from. 37 // Given an x value, find a parametric value it came from.
36 // x must be in [0, 1] range. Doesn't use gradients. 38 // x must be in [0, 1] range. Doesn't use gradients.
37 double SolveCurveX(double x, double epsilon) const; 39 double SolveCurveX(double x, double epsilon) const;
38 40
39 // Evaluates y at the given x with default epsilon. 41 // Evaluates y at the given x with default epsilon.
40 double Solve(double x) const; 42 double Solve(double x) const;
41 // Evaluates y at the given x. The epsilon parameter provides a hint as to the 43 // Evaluates y at the given x. The epsilon parameter provides a hint as to the
42 // required accuracy and is not guaranteed. Uses gradients if x is 44 // required accuracy and is not guaranteed. Uses gradients if x is
43 // out of [0, 1] range. 45 // out of [0, 1] range.
44 double SolveWithEpsilon(double x, double epsilon) const { 46 double SolveWithEpsilon(double x, double epsilon) const {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 87
86 double range_min_; 88 double range_min_;
87 double range_max_; 89 double range_max_;
88 90
89 DISALLOW_ASSIGN(CubicBezier); 91 DISALLOW_ASSIGN(CubicBezier);
90 }; 92 };
91 93
92 } // namespace gfx 94 } // namespace gfx
93 95
94 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ 96 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/animation/AnimationUtilities.h ('k') | ui/gfx/geometry/cubic_bezier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698