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