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

Side by Side Diff: cc/CCTimingFunction.cpp

Issue 11086053: Revert 161133 - [cc] Use base ptr types for cc's CSS animation classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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/CCTimingFunction.h ('k') | cc/LayerChromium.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "config.h" 5 #include "config.h"
6 6
7 #include "CCTimingFunction.h" 7 #include "CCTimingFunction.h"
8 8
9 #include <wtf/OwnPtr.h>
10
9 namespace { 11 namespace {
10 const double epsilon = 1e-6; 12 const double epsilon = 1e-6;
11 } // namespace 13 } // namespace
12 14
13 namespace cc { 15 namespace cc {
14 16
15 CCTimingFunction::CCTimingFunction() 17 CCTimingFunction::CCTimingFunction()
16 { 18 {
17 } 19 }
18 20
19 CCTimingFunction::~CCTimingFunction() 21 CCTimingFunction::~CCTimingFunction()
20 { 22 {
21 } 23 }
22 24
23 double CCTimingFunction::duration() const 25 double CCTimingFunction::duration() const
24 { 26 {
25 return 1.0; 27 return 1.0;
26 } 28 }
27 29
28 scoped_ptr<CCCubicBezierTimingFunction> CCCubicBezierTimingFunction::create(doub le x1, double y1, double x2, double y2) 30 PassOwnPtr<CCCubicBezierTimingFunction> CCCubicBezierTimingFunction::create(doub le x1, double y1, double x2, double y2)
29 { 31 {
30 return make_scoped_ptr(new CCCubicBezierTimingFunction(x1, y1, x2, y2)); 32 return adoptPtr(new CCCubicBezierTimingFunction(x1, y1, x2, y2));
31 } 33 }
32 34
33 CCCubicBezierTimingFunction::CCCubicBezierTimingFunction(double x1, double y1, d ouble x2, double y2) 35 CCCubicBezierTimingFunction::CCCubicBezierTimingFunction(double x1, double y1, d ouble x2, double y2)
34 : m_curve(x1, y1, x2, y2) 36 : m_curve(x1, y1, x2, y2)
35 { 37 {
36 } 38 }
37 39
38 CCCubicBezierTimingFunction::~CCCubicBezierTimingFunction() 40 CCCubicBezierTimingFunction::~CCCubicBezierTimingFunction()
39 { 41 {
40 } 42 }
41 43
42 float CCCubicBezierTimingFunction::getValue(double x) const 44 float CCCubicBezierTimingFunction::getValue(double x) const
43 { 45 {
44 UnitBezier temp(m_curve); 46 UnitBezier temp(m_curve);
45 return static_cast<float>(temp.solve(x, epsilon)); 47 return static_cast<float>(temp.solve(x, epsilon));
46 } 48 }
47 49
48 scoped_ptr<CCAnimationCurve> CCCubicBezierTimingFunction::clone() const 50 PassOwnPtr<CCAnimationCurve> CCCubicBezierTimingFunction::clone() const
49 { 51 {
50 return make_scoped_ptr(new CCCubicBezierTimingFunction(*this)).PassAs<CCAnim ationCurve>(); 52 return adoptPtr(new CCCubicBezierTimingFunction(*this));
51 } 53 }
52 54
53 // These numbers come from http://www.w3.org/TR/css3-transitions/#transition-tim ing-function_tag. 55 // These numbers come from http://www.w3.org/TR/css3-transitions/#transition-tim ing-function_tag.
54 scoped_ptr<CCTimingFunction> CCEaseTimingFunction::create() 56 PassOwnPtr<CCTimingFunction> CCEaseTimingFunction::create()
55 { 57 {
56 return CCCubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1).PassAs<CCTimi ngFunction>(); 58 return CCCubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1);
57 } 59 }
58 60
59 scoped_ptr<CCTimingFunction> CCEaseInTimingFunction::create() 61 PassOwnPtr<CCTimingFunction> CCEaseInTimingFunction::create()
60 { 62 {
61 return CCCubicBezierTimingFunction::create(0.42, 0, 1.0, 1).PassAs<CCTimingF unction>(); 63 return CCCubicBezierTimingFunction::create(0.42, 0, 1.0, 1);
62 } 64 }
63 65
64 scoped_ptr<CCTimingFunction> CCEaseOutTimingFunction::create() 66 PassOwnPtr<CCTimingFunction> CCEaseOutTimingFunction::create()
65 { 67 {
66 return CCCubicBezierTimingFunction::create(0, 0, 0.58, 1).PassAs<CCTimingFun ction>(); 68 return CCCubicBezierTimingFunction::create(0, 0, 0.58, 1);
67 } 69 }
68 70
69 scoped_ptr<CCTimingFunction> CCEaseInOutTimingFunction::create() 71 PassOwnPtr<CCTimingFunction> CCEaseInOutTimingFunction::create()
70 { 72 {
71 return CCCubicBezierTimingFunction::create(0.42, 0, 0.58, 1).PassAs<CCTiming Function>(); 73 return CCCubicBezierTimingFunction::create(0.42, 0, 0.58, 1);
72 } 74 }
73 75
74 } // namespace cc 76 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCTimingFunction.h ('k') | cc/LayerChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698