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; | |
20 | 19 |
21 namespace cc { | 20 namespace cc { |
22 | 21 |
23 static int s_nextLayerId = 1; | 22 static int s_nextLayerId = 1; |
24 | 23 |
25 scoped_refptr<Layer> Layer::create() | 24 scoped_refptr<Layer> Layer::create() |
26 { | 25 { |
27 return make_scoped_refptr(new Layer()); | 26 return make_scoped_refptr(new Layer()); |
28 } | 27 } |
29 | 28 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 376 } |
378 | 377 |
379 void Layer::setPosition(const gfx::PointF& position) | 378 void Layer::setPosition(const gfx::PointF& position) |
380 { | 379 { |
381 if (m_position == position) | 380 if (m_position == position) |
382 return; | 381 return; |
383 m_position = position; | 382 m_position = position; |
384 setNeedsCommit(); | 383 setNeedsCommit(); |
385 } | 384 } |
386 | 385 |
387 void Layer::setSublayerTransform(const WebTransformationMatrix& sublayerTransfor
m) | 386 void Layer::setSublayerTransform(const gfx::Transform& sublayerTransform) |
388 { | 387 { |
389 if (m_sublayerTransform == sublayerTransform) | 388 if (m_sublayerTransform == sublayerTransform) |
390 return; | 389 return; |
391 m_sublayerTransform = sublayerTransform; | 390 m_sublayerTransform = sublayerTransform; |
392 setNeedsCommit(); | 391 setNeedsCommit(); |
393 } | 392 } |
394 | 393 |
395 void Layer::setTransform(const WebTransformationMatrix& transform) | 394 void Layer::setTransform(const gfx::Transform& transform) |
396 { | 395 { |
397 if (m_transform == transform) | 396 if (m_transform == transform) |
398 return; | 397 return; |
399 m_transform = transform; | 398 m_transform = transform; |
400 setNeedsCommit(); | 399 setNeedsCommit(); |
401 } | 400 } |
402 | 401 |
403 bool Layer::transformIsAnimating() const | 402 bool Layer::transformIsAnimating() const |
404 { | 403 { |
405 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... |
473 } | 472 } |
474 | 473 |
475 void Layer::setForceRenderSurface(bool force) | 474 void Layer::setForceRenderSurface(bool force) |
476 { | 475 { |
477 if (m_forceRenderSurface == force) | 476 if (m_forceRenderSurface == force) |
478 return; | 477 return; |
479 m_forceRenderSurface = force; | 478 m_forceRenderSurface = force; |
480 setNeedsCommit(); | 479 setNeedsCommit(); |
481 } | 480 } |
482 | 481 |
483 void Layer::setImplTransform(const WebTransformationMatrix& transform) | 482 void Layer::setImplTransform(const gfx::Transform& transform) |
484 { | 483 { |
485 if (m_implTransform == transform) | 484 if (m_implTransform == transform) |
486 return; | 485 return; |
487 m_implTransform = transform; | 486 m_implTransform = transform; |
488 setNeedsCommit(); | 487 setNeedsCommit(); |
489 } | 488 } |
490 | 489 |
491 void Layer::setDoubleSided(bool doubleSided) | 490 void Layer::setDoubleSided(bool doubleSided) |
492 { | 491 { |
493 if (m_doubleSided == doubleSided) | 492 if (m_doubleSided == doubleSided) |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 718 } |
720 | 719 |
721 void Layer::setOpacityFromAnimation(float opacity) | 720 void Layer::setOpacityFromAnimation(float opacity) |
722 { | 721 { |
723 // 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 |
724 // 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 |
725 // 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
. |
726 m_opacity = opacity; | 725 m_opacity = opacity; |
727 } | 726 } |
728 | 727 |
729 const WebKit::WebTransformationMatrix& Layer::transform() const | 728 const gfx::Transform& Layer::transform() const |
730 { | 729 { |
731 return m_transform; | 730 return m_transform; |
732 } | 731 } |
733 | 732 |
734 void Layer::setTransformFromAnimation(const WebTransformationMatrix& transform) | 733 void Layer::setTransformFromAnimation(const gfx::Transform& transform) |
735 { | 734 { |
736 // 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 |
737 // 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 |
738 // 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. |
739 m_transform = transform; | 738 m_transform = transform; |
740 } | 739 } |
741 | 740 |
742 bool Layer::addAnimation(scoped_ptr <ActiveAnimation> animation) | 741 bool Layer::addAnimation(scoped_ptr <ActiveAnimation> animation) |
743 { | 742 { |
744 // 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... |
835 { | 834 { |
836 return 0; | 835 return 0; |
837 } | 836 } |
838 | 837 |
839 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*) |
840 { | 839 { |
841 // 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. |
842 } | 841 } |
843 | 842 |
844 } // namespace cc | 843 } // namespace cc |
OLD | NEW |