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

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

Issue 1871743003: ui: Add out-of-line copy ctors for complex classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « ui/gfx/geometry/cubic_bezier.h ('k') | ui/gfx/gpu_memory_buffer.h » ('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 #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"
11 11
12 namespace gfx { 12 namespace gfx {
13 13
14 static const double kBezierEpsilon = 1e-7; 14 static const double kBezierEpsilon = 1e-7;
15 15
16 CubicBezier::CubicBezier(double p1x, double p1y, double p2x, double p2y) { 16 CubicBezier::CubicBezier(double p1x, double p1y, double p2x, double p2y) {
17 InitCoefficients(p1x, p1y, p2x, p2y); 17 InitCoefficients(p1x, p1y, p2x, p2y);
18 InitGradients(p1x, p1y, p2x, p2y); 18 InitGradients(p1x, p1y, p2x, p2y);
19 InitRange(p1y, p2y); 19 InitRange(p1y, p2y);
20 } 20 }
21 21
22 CubicBezier::CubicBezier(const CubicBezier& other) = default;
23
22 void CubicBezier::InitCoefficients(double p1x, 24 void CubicBezier::InitCoefficients(double p1x,
23 double p1y, 25 double p1y,
24 double p2x, 26 double p2x,
25 double p2y) { 27 double p2y) {
26 // Calculate the polynomial coefficients, implicit first and last control 28 // Calculate the polynomial coefficients, implicit first and last control
27 // points are (0,0) and (1,1). 29 // points are (0,0) and (1,1).
28 cx_ = 3.0 * p1x; 30 cx_ = 3.0 * p1x;
29 bx_ = 3.0 * (p2x - p1x) - cx_; 31 bx_ = 3.0 * (p2x - p1x) - cx_;
30 ax_ = 1.0 - cx_ - bx_; 32 ax_ = 1.0 - cx_ - bx_;
31 33
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 double dx = SampleCurveDerivativeX(t); 174 double dx = SampleCurveDerivativeX(t);
173 double dy = SampleCurveDerivativeY(t); 175 double dy = SampleCurveDerivativeY(t);
174 return dy / dx; 176 return dy / dx;
175 } 177 }
176 178
177 double CubicBezier::Slope(double x) const { 179 double CubicBezier::Slope(double x) const {
178 return SlopeWithEpsilon(x, kBezierEpsilon); 180 return SlopeWithEpsilon(x, kBezierEpsilon);
179 } 181 }
180 182
181 } // namespace gfx 183 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/cubic_bezier.h ('k') | ui/gfx/gpu_memory_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698