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

Side by Side Diff: cc/layer_tree_host_unittest_animation.cc

Issue 12648005: cc: Chromify the LayerTreeHostImpl class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compl Created 7 years, 9 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/layer_tree_host_unittest.cc ('k') | cc/layer_tree_host_unittest_context.cc » ('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 "cc/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "cc/animation_curve.h" 7 #include "cc/animation_curve.h"
8 #include "cc/layer.h" 8 #include "cc/layer.h"
9 #include "cc/layer_animation_controller.h" 9 #include "cc/layer_animation_controller.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 started_animating_ = true; 178 started_animating_ = true;
179 } 179 }
180 180
181 virtual void drawLayersOnThread(LayerTreeHostImpl*) OVERRIDE { 181 virtual void drawLayersOnThread(LayerTreeHostImpl*) OVERRIDE {
182 if (started_animating_) 182 if (started_animating_)
183 endTest(); 183 endTest();
184 } 184 }
185 185
186 virtual bool prepareToDrawOnThread( 186 virtual bool prepareToDrawOnThread(
187 LayerTreeHostImpl* host_impl, 187 LayerTreeHostImpl* host_impl,
188 LayerTreeHostImpl::FrameData& frame, 188 LayerTreeHostImpl::FrameData* frame,
189 bool result) OVERRIDE { 189 bool result) OVERRIDE {
190 return false; 190 return false;
191 } 191 }
192 192
193 virtual void afterTest() OVERRIDE {} 193 virtual void afterTest() OVERRIDE {}
194 194
195 private: 195 private:
196 bool started_animating_; 196 bool started_animating_;
197 }; 197 };
198 198
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 float endOpacity = curve->GetValue(curve->Duration()); 264 float endOpacity = curve->GetValue(curve->Duration());
265 float linearly_interpolated_opacity = 265 float linearly_interpolated_opacity =
266 0.25 * endOpacity + 0.75 * startOpacity; 266 0.25 * endOpacity + 0.75 * startOpacity;
267 double time = curve->Duration() * 0.25; 267 double time = curve->Duration() * 0.25;
268 // If the linear timing function associated with this animation was not 268 // If the linear timing function associated with this animation was not
269 // picked up, then the linearly interpolated opacity would be different 269 // picked up, then the linearly interpolated opacity would be different
270 // because of the default ease timing function. 270 // because of the default ease timing function.
271 EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time)); 271 EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time));
272 272
273 LayerAnimationController* controller_impl = 273 LayerAnimationController* controller_impl =
274 host_impl->rootLayer()->layer_animation_controller(); 274 host_impl->RootLayer()->layer_animation_controller();
275 Animation* animation_impl = 275 Animation* animation_impl =
276 controller_impl->GetAnimation(0, Animation::Opacity); 276 controller_impl->GetAnimation(0, Animation::Opacity);
277 277
278 controller->RemoveAnimation(animation->id()); 278 controller->RemoveAnimation(animation->id());
279 controller_impl->RemoveAnimation(animation_impl->id()); 279 controller_impl->RemoveAnimation(animation_impl->id());
280 endTest(); 280 endTest();
281 } 281 }
282 282
283 virtual void afterTest() OVERRIDE {} 283 virtual void afterTest() OVERRIDE {}
284 }; 284 };
(...skipping 24 matching lines...) Expand all
309 controller->RemoveAnimation(animation->id()); 309 controller->RemoveAnimation(animation->id());
310 310
311 if (impl_start_time_ > 0) 311 if (impl_start_time_ > 0)
312 endTest(); 312 endTest();
313 } 313 }
314 314
315 virtual void updateAnimationState( 315 virtual void updateAnimationState(
316 LayerTreeHostImpl* impl_host, 316 LayerTreeHostImpl* impl_host,
317 bool hasUnfinishedAnimation) OVERRIDE { 317 bool hasUnfinishedAnimation) OVERRIDE {
318 LayerAnimationController* controller = 318 LayerAnimationController* controller =
319 impl_host->rootLayer()->layer_animation_controller(); 319 impl_host->RootLayer()->layer_animation_controller();
320 Animation* animation = 320 Animation* animation =
321 controller->GetAnimation(0, Animation::Opacity); 321 controller->GetAnimation(0, Animation::Opacity);
322 if (!animation) 322 if (!animation)
323 return; 323 return;
324 324
325 impl_start_time_ = animation->start_time(); 325 impl_start_time_ = animation->start_time();
326 controller->RemoveAnimation(animation->id()); 326 controller->RemoveAnimation(animation->id());
327 327
328 if (main_start_time_ > 0) 328 if (main_start_time_ > 0)
329 endTest(); 329 endTest();
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 private: 537 private:
538 int num_commit_complete_; 538 int num_commit_complete_;
539 int num_draw_layers_; 539 int num_draw_layers_;
540 }; 540 };
541 541
542 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate) 542 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestContinuousAnimate)
543 543
544 } // namespace 544 } // namespace
545 } // namespace cc 545 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host_unittest.cc ('k') | cc/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698