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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 1009233002: CC Animations: Port Impl-only-scrolling to use compositor animation timelines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui
Patch Set: Rearrange changes across episodes. Created 5 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 3461 matching lines...) Expand 10 before | Expand all | Expand 10 after
3472 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { 3472 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
3473 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3473 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3474 for (; it != swap_promise_monitor_.end(); it++) 3474 for (; it != swap_promise_monitor_.end(); it++)
3475 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); 3475 (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
3476 } 3476 }
3477 3477
3478 void LayerTreeHostImpl::ScrollAnimationCreate( 3478 void LayerTreeHostImpl::ScrollAnimationCreate(
3479 LayerImpl* layer_impl, 3479 LayerImpl* layer_impl,
3480 const gfx::ScrollOffset& target_offset, 3480 const gfx::ScrollOffset& target_offset,
3481 const gfx::ScrollOffset& current_offset) { 3481 const gfx::ScrollOffset& current_offset) {
3482 if (animation_timeline_)
3483 return animation_timeline_->ScrollAnimationCreate(
3484 layer_impl->id(), target_offset, current_offset);
3485
3482 scoped_ptr<ScrollOffsetAnimationCurve> curve = 3486 scoped_ptr<ScrollOffsetAnimationCurve> curve =
3483 ScrollOffsetAnimationCurve::Create(target_offset, 3487 ScrollOffsetAnimationCurve::Create(target_offset,
3484 EaseInOutTimingFunction::Create()); 3488 EaseInOutTimingFunction::Create());
3485 curve->SetInitialValue(current_offset); 3489 curve->SetInitialValue(current_offset);
3486 3490
3487 scoped_ptr<Animation> animation = Animation::Create( 3491 scoped_ptr<Animation> animation = Animation::Create(
3488 curve.Pass(), AnimationIdProvider::NextAnimationId(), 3492 curve.Pass(), AnimationIdProvider::NextAnimationId(),
3489 AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET); 3493 AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET);
3490 animation->set_is_impl_only(true); 3494 animation->set_is_impl_only(true);
3491 3495
3492 layer_impl->layer_animation_controller()->AddAnimation(animation.Pass()); 3496 layer_impl->layer_animation_controller()->AddAnimation(animation.Pass());
3493 } 3497 }
3494 3498
3495 bool LayerTreeHostImpl::ScrollAnimationUpdateTarget( 3499 bool LayerTreeHostImpl::ScrollAnimationUpdateTarget(
3496 LayerImpl* layer_impl, 3500 LayerImpl* layer_impl,
3497 const gfx::Vector2dF& scroll_delta) { 3501 const gfx::Vector2dF& scroll_delta) {
3502 if (animation_timeline_)
3503 return animation_timeline_->ScrollAnimationUpdateTarget(
3504 layer_impl->id(), scroll_delta, layer_impl->MaxScrollOffset(),
3505 CurrentBeginFrameArgs().frame_time);
3506
3498 Animation* animation = 3507 Animation* animation =
3499 layer_impl->layer_animation_controller() 3508 layer_impl->layer_animation_controller()
3500 ? layer_impl->layer_animation_controller()->GetAnimation( 3509 ? layer_impl->layer_animation_controller()->GetAnimation(
3501 Animation::SCROLL_OFFSET) 3510 Animation::SCROLL_OFFSET)
3502 : nullptr; 3511 : nullptr;
3503 if (!animation) 3512 if (!animation)
3504 return false; 3513 return false;
3505 3514
3506 ScrollOffsetAnimationCurve* curve = 3515 ScrollOffsetAnimationCurve* curve =
3507 animation->curve()->ToScrollOffsetAnimationCurve(); 3516 animation->curve()->ToScrollOffsetAnimationCurve();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 const gfx::Transform& transform) { 3608 const gfx::Transform& transform) {
3600 if (affects_active_tree) { 3609 if (affects_active_tree) {
3601 SetTreeLayerTransformMutated(layer_id, active_tree(), transform); 3610 SetTreeLayerTransformMutated(layer_id, active_tree(), transform);
3602 } else { 3611 } else {
3603 SetTreeLayerTransformMutated(layer_id, pending_tree(), transform); 3612 SetTreeLayerTransformMutated(layer_id, pending_tree(), transform);
3604 SetTreeLayerTransformMutated(layer_id, recycle_tree(), transform); 3613 SetTreeLayerTransformMutated(layer_id, recycle_tree(), transform);
3605 } 3614 }
3606 } 3615 }
3607 3616
3608 } // namespace cc 3617 } // namespace cc
OLDNEW
« cc/animation/animation_timeline.cc ('K') | « cc/animation/animation_timeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698