OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 "cc/blink/web_compositor_animation_player_impl.h" |
| 6 |
| 7 #include "cc/animation/animation_player.h" |
| 8 #include "cc/blink/web_animation_impl.h" |
| 9 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" |
| 10 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 11 |
| 12 using cc::AnimationPlayer; |
| 13 |
| 14 namespace cc_blink { |
| 15 |
| 16 WebCompositorAnimationPlayerImpl::WebCompositorAnimationPlayerImpl() |
| 17 : animation_player_(AnimationPlayer::Create()) { |
| 18 } |
| 19 |
| 20 WebCompositorAnimationPlayerImpl::~WebCompositorAnimationPlayerImpl() { |
| 21 } |
| 22 |
| 23 CC_BLINK_EXPORT cc::AnimationPlayer* |
| 24 WebCompositorAnimationPlayerImpl::animation_player() const { |
| 25 return animation_player_.get(); |
| 26 } |
| 27 |
| 28 void WebCompositorAnimationPlayerImpl::setAnimationDelegate( |
| 29 blink::WebCompositorAnimationDelegate* delegate) { |
| 30 animation_delegate_adapter_.reset( |
| 31 new WebToCCAnimationDelegateAdapter(delegate)); |
| 32 animation_player_->set_layer_animation_delegate( |
| 33 animation_delegate_adapter_.get()); |
| 34 } |
| 35 |
| 36 void WebCompositorAnimationPlayerImpl::attachLayer(blink::WebLayer* web_layer) { |
| 37 animation_player_->AttachLayer(web_layer->id()); |
| 38 } |
| 39 |
| 40 void WebCompositorAnimationPlayerImpl::detachLayer() { |
| 41 animation_player_->DetachLayer(); |
| 42 } |
| 43 |
| 44 void WebCompositorAnimationPlayerImpl::addAnimation( |
| 45 blink::WebCompositorAnimation* animation) { |
| 46 animation_player_->AddAnimation( |
| 47 static_cast<WebCompositorAnimationImpl*>(animation)->PassAnimation()); |
| 48 delete animation; |
| 49 } |
| 50 |
| 51 void WebCompositorAnimationPlayerImpl::removeAnimation(int animation_id) { |
| 52 animation_player_->RemoveAnimation(animation_id); |
| 53 } |
| 54 |
| 55 void WebCompositorAnimationPlayerImpl::pauseAnimation(int animation_id, |
| 56 double time_offset) { |
| 57 animation_player_->PauseAnimation(animation_id, time_offset); |
| 58 } |
| 59 |
| 60 } // namespace cc_blink |
OLD | NEW |