OLD | NEW |
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 p1x, double p1y, double p2x, double p2y); | 15 CubicBezier(double p1x, double p1y, double p2x, double p2y); |
| 16 CubicBezier(const CubicBezier& other); |
16 | 17 |
17 double SampleCurveX(double t) const { | 18 double SampleCurveX(double t) const { |
18 // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule. | 19 // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule. |
19 return ((ax_ * t + bx_) * t + cx_) * t; | 20 return ((ax_ * t + bx_) * t + cx_) * t; |
20 } | 21 } |
21 | 22 |
22 double SampleCurveY(double t) const { | 23 double SampleCurveY(double t) const { |
23 return ((ay_ * t + by_) * t + cy_) * t; | 24 return ((ay_ * t + by_) * t + cy_) * t; |
24 } | 25 } |
25 | 26 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 double range_min_; | 82 double range_min_; |
82 double range_max_; | 83 double range_max_; |
83 | 84 |
84 DISALLOW_ASSIGN(CubicBezier); | 85 DISALLOW_ASSIGN(CubicBezier); |
85 }; | 86 }; |
86 | 87 |
87 } // namespace gfx | 88 } // namespace gfx |
88 | 89 |
89 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ | 90 #endif // UI_GFX_GEOMETRY_CUBIC_BEZIER_H_ |
OLD | NEW |