| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layer.h" |
| 6 | 6 |
| 7 #include "cc/active_animation.h" | 7 #include "cc/animation.h" |
| 8 #include "cc/animation_events.h" | 8 #include "cc/animation_events.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" |
| 11 #include "cc/layer_tree_host.h" | 11 #include "cc/layer_tree_host.h" |
| 12 #include "cc/layer_tree_impl.h" | 12 #include "cc/layer_tree_impl.h" |
| 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat
e.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationDelegat
e.h" |
| 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerScrollClien
t.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerScrollClien
t.h" |
| 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 16 #include "third_party/skia/include/core/SkImageFilter.h" | 16 #include "third_party/skia/include/core/SkImageFilter.h" |
| 17 #include "ui/gfx/rect_conversions.h" | 17 #include "ui/gfx/rect_conversions.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 setNeedsCommit(); | 379 setNeedsCommit(); |
| 380 } | 380 } |
| 381 | 381 |
| 382 float Layer::opacity() const | 382 float Layer::opacity() const |
| 383 { | 383 { |
| 384 return m_opacity; | 384 return m_opacity; |
| 385 } | 385 } |
| 386 | 386 |
| 387 bool Layer::opacityIsAnimating() const | 387 bool Layer::opacityIsAnimating() const |
| 388 { | 388 { |
| 389 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opac
ity); | 389 return m_layerAnimationController->isAnimatingProperty(Animation::Opacity); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void Layer::setContentsOpaque(bool opaque) | 392 void Layer::setContentsOpaque(bool opaque) |
| 393 { | 393 { |
| 394 if (m_contentsOpaque == opaque) | 394 if (m_contentsOpaque == opaque) |
| 395 return; | 395 return; |
| 396 m_contentsOpaque = opaque; | 396 m_contentsOpaque = opaque; |
| 397 setNeedsDisplay(); | 397 setNeedsDisplay(); |
| 398 } | 398 } |
| 399 | 399 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 421 setNeedsCommit(); | 421 setNeedsCommit(); |
| 422 } | 422 } |
| 423 | 423 |
| 424 const gfx::Transform& Layer::transform() const | 424 const gfx::Transform& Layer::transform() const |
| 425 { | 425 { |
| 426 return m_transform; | 426 return m_transform; |
| 427 } | 427 } |
| 428 | 428 |
| 429 bool Layer::transformIsAnimating() const | 429 bool Layer::transformIsAnimating() const |
| 430 { | 430 { |
| 431 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); | 431 return m_layerAnimationController->isAnimatingProperty(Animation::Transform)
; |
| 432 } | 432 } |
| 433 | 433 |
| 434 void Layer::setScrollOffset(gfx::Vector2d scrollOffset) | 434 void Layer::setScrollOffset(gfx::Vector2d scrollOffset) |
| 435 { | 435 { |
| 436 if (m_scrollOffset == scrollOffset) | 436 if (m_scrollOffset == scrollOffset) |
| 437 return; | 437 return; |
| 438 m_scrollOffset = scrollOffset; | 438 m_scrollOffset = scrollOffset; |
| 439 if (m_layerScrollClient) | 439 if (m_layerScrollClient) |
| 440 m_layerScrollClient->didScroll(); | 440 m_layerScrollClient->didScroll(); |
| 441 setNeedsFullTreeSync(); | 441 setNeedsFullTreeSync(); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 } | 741 } |
| 742 | 742 |
| 743 void Layer::OnTransformAnimated(const gfx::Transform& transform) | 743 void Layer::OnTransformAnimated(const gfx::Transform& transform) |
| 744 { | 744 { |
| 745 // This is called due to an ongoing accelerated animation. Since this animat
ion is | 745 // This is called due to an ongoing accelerated animation. Since this animat
ion is |
| 746 // also being run on the impl thread, there is no need to request a commit t
o push | 746 // also being run on the impl thread, there is no need to request a commit t
o push |
| 747 // this value over, so set this value directly rather than calling setTransf
orm. | 747 // this value over, so set this value directly rather than calling setTransf
orm. |
| 748 m_transform = transform; | 748 m_transform = transform; |
| 749 } | 749 } |
| 750 | 750 |
| 751 bool Layer::addAnimation(scoped_ptr <ActiveAnimation> animation) | 751 bool Layer::addAnimation(scoped_ptr <Animation> animation) |
| 752 { | 752 { |
| 753 // WebCore currently assumes that accelerated animations will start soon | 753 // WebCore currently assumes that accelerated animations will start soon |
| 754 // after the animation is added. However we cannot guarantee that if we do | 754 // after the animation is added. However we cannot guarantee that if we do |
| 755 // not have a layerTreeHost that will setNeedsCommit(). | 755 // not have a layerTreeHost that will setNeedsCommit(). |
| 756 // Unfortunately, the fix below to guarantee correctness causes performance | 756 // Unfortunately, the fix below to guarantee correctness causes performance |
| 757 // regressions on Android, since Android has shipped for a long time | 757 // regressions on Android, since Android has shipped for a long time |
| 758 // with all animations accelerated. For this reason, we will live with | 758 // with all animations accelerated. For this reason, we will live with |
| 759 // this bug only on Android until the bug is fixed. | 759 // this bug only on Android until the bug is fixed. |
| 760 // http://crbug.com/129683 | 760 // http://crbug.com/129683 |
| 761 #if !defined(OS_ANDROID) | 761 #if !defined(OS_ANDROID) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 { | 856 { |
| 857 return 0; | 857 return 0; |
| 858 } | 858 } |
| 859 | 859 |
| 860 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 860 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
| 861 { | 861 { |
| 862 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 862 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
| 863 } | 863 } |
| 864 | 864 |
| 865 } // namespace cc | 865 } // namespace cc |
| OLD | NEW |