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

Side by Side Diff: cc/test/CCAnimationTestCommon.cpp

Issue 10909020: Enable webkit_compositor_unittests (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 | « cc/test/CCAnimationTestCommon.h ('k') | cc/test/CCTiledLayerTestCommon.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 "CCAnimationTestCommon.h" 7 #include "CCAnimationTestCommon.h"
8 8
9 #include "CCKeyframedAnimationCurve.h" 9 #include "CCKeyframedAnimationCurve.h"
10 #include "CCLayerAnimationController.h" 10 #include "CCLayerAnimationController.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 namespace WebKitTests { 58 namespace WebKitTests {
59 59
60 FakeFloatAnimationCurve::FakeFloatAnimationCurve() 60 FakeFloatAnimationCurve::FakeFloatAnimationCurve()
61 { 61 {
62 } 62 }
63 63
64 FakeFloatAnimationCurve::~FakeFloatAnimationCurve() 64 FakeFloatAnimationCurve::~FakeFloatAnimationCurve()
65 { 65 {
66 } 66 }
67 67
68 double FakeFloatAnimationCurve::duration() const
69 {
70 return 1;
71 }
72
73 float FakeFloatAnimationCurve::getValue(double now) const
74 {
75 return 0;
76 }
77
68 PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatAnimationCurve::clone() const 78 PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatAnimationCurve::clone() const
69 { 79 {
70 return adoptPtr(new FakeFloatAnimationCurve); 80 return adoptPtr(new FakeFloatAnimationCurve);
71 } 81 }
72 82
73 FakeTransformTransition::FakeTransformTransition(double duration) 83 FakeTransformTransition::FakeTransformTransition(double duration)
74 : m_duration(duration) 84 : m_duration(duration)
75 { 85 {
76 } 86 }
77 87
78 FakeTransformTransition::~FakeTransformTransition() 88 FakeTransformTransition::~FakeTransformTransition()
79 { 89 {
80 } 90 }
81 91
92 double FakeTransformTransition::duration() const
93 {
94 return m_duration;
95 }
96
82 WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c onst 97 WebKit::WebTransformationMatrix FakeTransformTransition::getValue(double time) c onst
83 { 98 {
84 return WebKit::WebTransformationMatrix(); 99 return WebKit::WebTransformationMatrix();
85 } 100 }
86 101
87 PassOwnPtr<WebCore::CCAnimationCurve> FakeTransformTransition::clone() const 102 PassOwnPtr<WebCore::CCAnimationCurve> FakeTransformTransition::clone() const
88 { 103 {
89 return adoptPtr(new FakeTransformTransition(*this)); 104 return adoptPtr(new FakeTransformTransition(*this));
90 } 105 }
91 106
92 107
93 FakeFloatTransition::FakeFloatTransition(double duration, float from, float to) 108 FakeFloatTransition::FakeFloatTransition(double duration, float from, float to)
94 : m_duration(duration) 109 : m_duration(duration)
95 , m_from(from) 110 , m_from(from)
96 , m_to(to) 111 , m_to(to)
97 { 112 {
98 } 113 }
99 114
100 FakeFloatTransition::~FakeFloatTransition() 115 FakeFloatTransition::~FakeFloatTransition()
101 { 116 {
102 } 117 }
103 118
119 double FakeFloatTransition::duration() const
120 {
121 return m_duration;
122 }
123
104 float FakeFloatTransition::getValue(double time) const 124 float FakeFloatTransition::getValue(double time) const
105 { 125 {
106 time /= m_duration; 126 time /= m_duration;
107 if (time >= 1) 127 if (time >= 1)
108 time = 1; 128 time = 1;
109 return (1 - time) * m_from + time * m_to; 129 return (1 - time) * m_from + time * m_to;
110 } 130 }
111 131
112 FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient() 132 FakeLayerAnimationControllerClient::FakeLayerAnimationControllerClient()
113 : m_opacity(0) 133 : m_opacity(0)
114 { 134 {
115 } 135 }
116 136
117 FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient() 137 FakeLayerAnimationControllerClient::~FakeLayerAnimationControllerClient()
118 { 138 {
119 } 139 }
120 140
141 int FakeLayerAnimationControllerClient::id() const
142 {
143 return 0;
144 }
145
146 void FakeLayerAnimationControllerClient::setOpacityFromAnimation(float opacity)
147 {
148 m_opacity = opacity;
149 }
150
151 float FakeLayerAnimationControllerClient::opacity() const
152 {
153 return m_opacity;
154 }
155
156 void FakeLayerAnimationControllerClient::setTransformFromAnimation(const WebKit: :WebTransformationMatrix& transform)
157 {
158 m_transform = transform;
159 }
160
161 const WebKit::WebTransformationMatrix& FakeLayerAnimationControllerClient::trans form() const
162 {
163 return m_transform;
164 }
165
121 PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatTransition::clone() const 166 PassOwnPtr<WebCore::CCAnimationCurve> FakeFloatTransition::clone() const
122 { 167 {
123 return adoptPtr(new FakeFloatTransition(*this)); 168 return adoptPtr(new FakeFloatTransition(*this));
124 } 169 }
125 170
126 void addOpacityTransitionToController(WebCore::CCLayerAnimationController& contr oller, double duration, float startOpacity, float endOpacity, bool useTimingFunc tion) 171 void addOpacityTransitionToController(WebCore::CCLayerAnimationController& contr oller, double duration, float startOpacity, float endOpacity, bool useTimingFunc tion)
127 { 172 {
128 addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimi ngFunction); 173 addOpacityTransition(controller, duration, startOpacity, endOpacity, useTimi ngFunction);
129 } 174 }
130 175
(...skipping 16 matching lines...) Expand all
147 { 192 {
148 addAnimatedTransform(layer, duration, deltaX, deltaY); 193 addAnimatedTransform(layer, duration, deltaX, deltaY);
149 } 194 }
150 195
151 void addAnimatedTransformToLayer(WebCore::CCLayerImpl& layer, double duration, i nt deltaX, int deltaY) 196 void addAnimatedTransformToLayer(WebCore::CCLayerImpl& layer, double duration, i nt deltaX, int deltaY)
152 { 197 {
153 addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, de ltaY); 198 addAnimatedTransform(*layer.layerAnimationController(), duration, deltaX, de ltaY);
154 } 199 }
155 200
156 } // namespace WebKitTests 201 } // namespace WebKitTests
OLDNEW
« no previous file with comments | « cc/test/CCAnimationTestCommon.h ('k') | cc/test/CCTiledLayerTestCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698