OLD | NEW |
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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
| 8 #include "cc/animation/keyframed_animation_curve.h" |
8 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
9 #include "cc/animation/scroll_offset_animation_curve.h" | 10 #include "cc/animation/scroll_offset_animation_curve.h" |
10 #include "cc/animation/timing_function.h" | 11 #include "cc/animation/timing_function.h" |
11 #include "cc/layers/layer.h" | 12 #include "cc/layers/layer.h" |
12 #include "cc/layers/layer_impl.h" | 13 #include "cc/layers/layer_impl.h" |
13 #include "cc/test/animation_test_common.h" | 14 #include "cc/test/animation_test_common.h" |
14 #include "cc/test/fake_content_layer.h" | 15 #include "cc/test/fake_content_layer.h" |
15 #include "cc/test/fake_content_layer_client.h" | 16 #include "cc/test/fake_content_layer_client.h" |
16 #include "cc/test/layer_tree_test.h" | 17 #include "cc/test/layer_tree_test.h" |
17 #include "cc/trees/layer_tree_impl.h" | 18 #include "cc/trees/layer_tree_impl.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 virtual void BeginTest() OVERRIDE { | 691 virtual void BeginTest() OVERRIDE { |
691 PostSetNeedsCommitToMainThread(); | 692 PostSetNeedsCommitToMainThread(); |
692 } | 693 } |
693 | 694 |
694 virtual void DidCommit() OVERRIDE { | 695 virtual void DidCommit() OVERRIDE { |
695 if (layer_tree_host()->source_frame_number() == 1) { | 696 if (layer_tree_host()->source_frame_number() == 1) { |
696 scoped_refptr<Layer> layer = Layer::Create(); | 697 scoped_refptr<Layer> layer = Layer::Create(); |
697 layer->set_layer_animation_delegate(this); | 698 layer->set_layer_animation_delegate(this); |
698 | 699 |
699 // Any valid AnimationCurve will do here. | 700 // Any valid AnimationCurve will do here. |
700 scoped_ptr<AnimationCurve> curve(EaseTimingFunction::Create()); | 701 scoped_ptr<AnimationCurve> curve(KeyframedFloatAnimationCurve::Create()); |
701 scoped_ptr<Animation> animation( | 702 scoped_ptr<Animation> animation( |
702 Animation::Create(curve.Pass(), 1, 1, | 703 Animation::Create(curve.Pass(), 1, 1, |
703 Animation::Opacity)); | 704 Animation::Opacity)); |
704 layer->layer_animation_controller()->AddAnimation(animation.Pass()); | 705 layer->layer_animation_controller()->AddAnimation(animation.Pass()); |
705 | 706 |
706 // We add the animation *before* attaching the layer to the tree. | 707 // We add the animation *before* attaching the layer to the tree. |
707 layer_tree_host()->root_layer()->AddChild(layer); | 708 layer_tree_host()->root_layer()->AddChild(layer); |
708 } | 709 } |
709 } | 710 } |
710 | 711 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 private: | 1285 private: |
1285 scoped_refptr<Layer> content_; | 1286 scoped_refptr<Layer> content_; |
1286 int num_swap_buffers_; | 1287 int num_swap_buffers_; |
1287 }; | 1288 }; |
1288 | 1289 |
1289 SINGLE_AND_MULTI_THREAD_TEST_F( | 1290 SINGLE_AND_MULTI_THREAD_TEST_F( |
1290 LayerTreeHostAnimationTestAddAnimationAfterAnimating); | 1291 LayerTreeHostAnimationTestAddAnimationAfterAnimating); |
1291 | 1292 |
1292 } // namespace | 1293 } // namespace |
1293 } // namespace cc | 1294 } // namespace cc |
OLD | NEW |