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

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

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
« no previous file with comments | « ui/gfx/geometry/cubic_bezier.h ('k') | 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 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 #include "ui/gfx/geometry/cubic_bezier.h" 5 #include "ui/gfx/geometry/cubic_bezier.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (0 < t1 && t1 < 1) 125 if (0 < t1 && t1 < 1)
126 sol1 = SampleCurveY(t1); 126 sol1 = SampleCurveY(t1);
127 127
128 if (0 < t2 && t2 < 1) 128 if (0 < t2 && t2 < 1)
129 sol2 = SampleCurveY(t2); 129 sol2 = SampleCurveY(t2);
130 130
131 range_min_ = std::min(std::min(range_min_, sol1), sol2); 131 range_min_ = std::min(std::min(range_min_, sol1), sol2);
132 range_max_ = std::max(std::max(range_max_, sol1), sol2); 132 range_max_ = std::max(std::max(range_max_, sol1), sol2);
133 } 133 }
134 134
135 double CubicBezier::GetDefaultEpsilon() {
136 return kBezierEpsilon;
137 }
138
135 double CubicBezier::SolveCurveX(double x, double epsilon) const { 139 double CubicBezier::SolveCurveX(double x, double epsilon) const {
136 DCHECK_GE(x, 0.0); 140 DCHECK_GE(x, 0.0);
137 DCHECK_LE(x, 1.0); 141 DCHECK_LE(x, 1.0);
138 142
139 double t0; 143 double t0;
140 double t1; 144 double t1;
141 double t2; 145 double t2;
142 double x2; 146 double x2;
143 double d2; 147 double d2;
144 int i; 148 int i;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 204
201 double CubicBezier::GetX2() const { 205 double CubicBezier::GetX2() const {
202 return (bx_ + cx_) / 3.0 + GetX1(); 206 return (bx_ + cx_) / 3.0 + GetX1();
203 } 207 }
204 208
205 double CubicBezier::GetY2() const { 209 double CubicBezier::GetY2() const {
206 return (by_ + cy_) / 3.0 + GetY1(); 210 return (by_ + cy_) / 3.0 + GetY1();
207 } 211 }
208 212
209 } // namespace gfx 213 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/cubic_bezier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698