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

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

Issue 393713002: Scroll offset animation curve retargeting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove workaround. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | ui/gfx/geometry/cubic_bezier.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 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
11 namespace gfx { 11 namespace gfx {
12 12
13 class GFX_EXPORT CubicBezier { 13 class GFX_EXPORT CubicBezier {
14 public: 14 public:
15 CubicBezier(double x1, double y1, double x2, double y2); 15 CubicBezier(double x1, double y1, double x2, double y2);
16 ~CubicBezier(); 16 ~CubicBezier();
17 17
18 // Returns an approximation of y at the given x. 18 // Returns an approximation of y at the given x.
19 double Solve(double x) const; 19 double Solve(double x) const;
20 20
21 // Returns an approximation of dy/dx at the given x.
22 double Slope(double x) const;
23
21 // Sets |min| and |max| to the bezier's minimum and maximium y values in the 24 // Sets |min| and |max| to the bezier's minimum and maximium y values in the
22 // interval [0, 1]. 25 // interval [0, 1].
23 void Range(double* min, double* max) const; 26 void Range(double* min, double* max) const;
24 27
25 private: 28 private:
26 double x1_; 29 double x1_;
27 double y1_; 30 double y1_;
28 double x2_; 31 double x2_;
29 double y2_; 32 double y2_;
30 33
31 DISALLOW_ASSIGN(CubicBezier); 34 DISALLOW_ASSIGN(CubicBezier);
32 }; 35 };
33 36
34 } // namespace gfx 37 } // namespace gfx
35 38
36 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ 39 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | ui/gfx/geometry/cubic_bezier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698