| 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/active_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 "third_party/skia/include/core/SkImageFilter.h" | 12 #include "third_party/skia/include/core/SkImageFilter.h" |
| 13 #include "ui/gfx/rect_conversions.h" | 13 #include "ui/gfx/rect_conversions.h" |
| 14 #include <public/WebAnimationDelegate.h> | 14 #include <public/WebAnimationDelegate.h> |
| 15 #include <public/WebLayerScrollClient.h> | 15 #include <public/WebLayerScrollClient.h> |
| 16 #include <public/WebSize.h> | 16 #include <public/WebSize.h> |
| 17 | 17 |
| 18 using namespace std; | 18 using namespace std; |
| 19 using WebKit::WebTransformationMatrix; | 19 using gfx::Transform; |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 | 22 |
| 23 static int s_nextLayerId = 1; | 23 static int s_nextLayerId = 1; |
| 24 | 24 |
| 25 scoped_refptr<Layer> Layer::create() | 25 scoped_refptr<Layer> Layer::create() |
| 26 { | 26 { |
| 27 return make_scoped_refptr(new Layer()); | 27 return make_scoped_refptr(new Layer()); |
| 28 } | 28 } |
| 29 | 29 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 377 } |
| 378 | 378 |
| 379 void Layer::setPosition(const gfx::PointF& position) | 379 void Layer::setPosition(const gfx::PointF& position) |
| 380 { | 380 { |
| 381 if (m_position == position) | 381 if (m_position == position) |
| 382 return; | 382 return; |
| 383 m_position = position; | 383 m_position = position; |
| 384 setNeedsCommit(); | 384 setNeedsCommit(); |
| 385 } | 385 } |
| 386 | 386 |
| 387 void Layer::setSublayerTransform(const WebTransformationMatrix& sublayerTransfor
m) | 387 void Layer::setSublayerTransform(const Transform& sublayerTransform) |
| 388 { | 388 { |
| 389 if (m_sublayerTransform == sublayerTransform) | 389 if (m_sublayerTransform == sublayerTransform) |
| 390 return; | 390 return; |
| 391 m_sublayerTransform = sublayerTransform; | 391 m_sublayerTransform = sublayerTransform; |
| 392 setNeedsCommit(); | 392 setNeedsCommit(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void Layer::setTransform(const WebTransformationMatrix& transform) | 395 void Layer::setTransform(const Transform& transform) |
| 396 { | 396 { |
| 397 if (m_transform == transform) | 397 if (m_transform == transform) |
| 398 return; | 398 return; |
| 399 m_transform = transform; | 399 m_transform = transform; |
| 400 setNeedsCommit(); | 400 setNeedsCommit(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 bool Layer::transformIsAnimating() const | 403 bool Layer::transformIsAnimating() const |
| 404 { | 404 { |
| 405 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); | 405 return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Tran
sform); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 473 } |
| 474 | 474 |
| 475 void Layer::setForceRenderSurface(bool force) | 475 void Layer::setForceRenderSurface(bool force) |
| 476 { | 476 { |
| 477 if (m_forceRenderSurface == force) | 477 if (m_forceRenderSurface == force) |
| 478 return; | 478 return; |
| 479 m_forceRenderSurface = force; | 479 m_forceRenderSurface = force; |
| 480 setNeedsCommit(); | 480 setNeedsCommit(); |
| 481 } | 481 } |
| 482 | 482 |
| 483 void Layer::setImplTransform(const WebTransformationMatrix& transform) | 483 void Layer::setImplTransform(const Transform& transform) |
| 484 { | 484 { |
| 485 if (m_implTransform == transform) | 485 if (m_implTransform == transform) |
| 486 return; | 486 return; |
| 487 m_implTransform = transform; | 487 m_implTransform = transform; |
| 488 setNeedsCommit(); | 488 setNeedsCommit(); |
| 489 } | 489 } |
| 490 | 490 |
| 491 void Layer::setDoubleSided(bool doubleSided) | 491 void Layer::setDoubleSided(bool doubleSided) |
| 492 { | 492 { |
| 493 if (m_doubleSided == doubleSided) | 493 if (m_doubleSided == doubleSided) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 } | 719 } |
| 720 | 720 |
| 721 void Layer::setOpacityFromAnimation(float opacity) | 721 void Layer::setOpacityFromAnimation(float opacity) |
| 722 { | 722 { |
| 723 // This is called due to an ongoing accelerated animation. Since this animat
ion is | 723 // This is called due to an ongoing accelerated animation. Since this animat
ion is |
| 724 // also being run on the impl thread, there is no need to request a commit t
o push | 724 // also being run on the impl thread, there is no need to request a commit t
o push |
| 725 // this value over, so set the value directly rather than calling setOpacity
. | 725 // this value over, so set the value directly rather than calling setOpacity
. |
| 726 m_opacity = opacity; | 726 m_opacity = opacity; |
| 727 } | 727 } |
| 728 | 728 |
| 729 const WebKit::WebTransformationMatrix& Layer::transform() const | 729 const gfx::Transform& Layer::transform() const |
| 730 { | 730 { |
| 731 return m_transform; | 731 return m_transform; |
| 732 } | 732 } |
| 733 | 733 |
| 734 void Layer::setTransformFromAnimation(const WebTransformationMatrix& transform) | 734 void Layer::setTransformFromAnimation(const Transform& transform) |
| 735 { | 735 { |
| 736 // This is called due to an ongoing accelerated animation. Since this animat
ion is | 736 // This is called due to an ongoing accelerated animation. Since this animat
ion is |
| 737 // also being run on the impl thread, there is no need to request a commit t
o push | 737 // also being run on the impl thread, there is no need to request a commit t
o push |
| 738 // this value over, so set this value directly rather than calling setTransf
orm. | 738 // this value over, so set this value directly rather than calling setTransf
orm. |
| 739 m_transform = transform; | 739 m_transform = transform; |
| 740 } | 740 } |
| 741 | 741 |
| 742 bool Layer::addAnimation(scoped_ptr <ActiveAnimation> animation) | 742 bool Layer::addAnimation(scoped_ptr <ActiveAnimation> animation) |
| 743 { | 743 { |
| 744 // WebCore currently assumes that accelerated animations will start soon | 744 // WebCore currently assumes that accelerated animations will start soon |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 { | 835 { |
| 836 return 0; | 836 return 0; |
| 837 } | 837 } |
| 838 | 838 |
| 839 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 839 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
| 840 { | 840 { |
| 841 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 841 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
| 842 } | 842 } |
| 843 | 843 |
| 844 } // namespace cc | 844 } // namespace cc |
| OLD | NEW |