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

Side by Side Diff: cc/CCTimingFunction.cpp

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (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/CCVideoLayerImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "CCTimingFunction.h"
8
9 namespace {
10 const double epsilon = 1e-6;
11 } // namespace
12
13 namespace cc {
14
15 CCTimingFunction::CCTimingFunction()
16 {
17 }
18
19 CCTimingFunction::~CCTimingFunction()
20 {
21 }
22
23 double CCTimingFunction::duration() const
24 {
25 return 1.0;
26 }
27
28 scoped_ptr<CCCubicBezierTimingFunction> CCCubicBezierTimingFunction::create(doub le x1, double y1, double x2, double y2)
29 {
30 return make_scoped_ptr(new CCCubicBezierTimingFunction(x1, y1, x2, y2));
31 }
32
33 CCCubicBezierTimingFunction::CCCubicBezierTimingFunction(double x1, double y1, d ouble x2, double y2)
34 : m_curve(x1, y1, x2, y2)
35 {
36 }
37
38 CCCubicBezierTimingFunction::~CCCubicBezierTimingFunction()
39 {
40 }
41
42 float CCCubicBezierTimingFunction::getValue(double x) const
43 {
44 UnitBezier temp(m_curve);
45 return static_cast<float>(temp.solve(x, epsilon));
46 }
47
48 scoped_ptr<CCAnimationCurve> CCCubicBezierTimingFunction::clone() const
49 {
50 return make_scoped_ptr(new CCCubicBezierTimingFunction(*this)).PassAs<CCAnim ationCurve>();
51 }
52
53 // These numbers come from http://www.w3.org/TR/css3-transitions/#transition-tim ing-function_tag.
54 scoped_ptr<CCTimingFunction> CCEaseTimingFunction::create()
55 {
56 return CCCubicBezierTimingFunction::create(0.25, 0.1, 0.25, 1).PassAs<CCTimi ngFunction>();
57 }
58
59 scoped_ptr<CCTimingFunction> CCEaseInTimingFunction::create()
60 {
61 return CCCubicBezierTimingFunction::create(0.42, 0, 1.0, 1).PassAs<CCTimingF unction>();
62 }
63
64 scoped_ptr<CCTimingFunction> CCEaseOutTimingFunction::create()
65 {
66 return CCCubicBezierTimingFunction::create(0, 0, 0.58, 1).PassAs<CCTimingFun ction>();
67 }
68
69 scoped_ptr<CCTimingFunction> CCEaseInOutTimingFunction::create()
70 {
71 return CCCubicBezierTimingFunction::create(0.42, 0, 0.58, 1).PassAs<CCTiming Function>();
72 }
73
74 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCTimingFunction.h ('k') | cc/CCVideoLayerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698