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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 scoped_refptr<Layer> Layer::create() | 24 scoped_refptr<Layer> Layer::create() |
25 { | 25 { |
26 return make_scoped_refptr(new Layer()); | 26 return make_scoped_refptr(new Layer()); |
27 } | 27 } |
28 | 28 |
29 Layer::Layer() | 29 Layer::Layer() |
30 : m_needsDisplay(false) | 30 : m_needsDisplay(false) |
31 , m_stackingOrderChanged(false) | 31 , m_stackingOrderChanged(false) |
32 , m_layerId(s_nextLayerId++) | 32 , m_layerId(s_nextLayerId++) |
| 33 , m_ignoreSetNeedsCommit(false) |
33 , m_parent(0) | 34 , m_parent(0) |
34 , m_layerTreeHost(0) | 35 , m_layerTreeHost(0) |
35 , m_layerAnimationController(LayerAnimationController::create(this)) | 36 , m_layerAnimationController(LayerAnimationController::create(this)) |
36 , m_scrollable(false) | 37 , m_scrollable(false) |
37 , m_shouldScrollOnMainThread(false) | 38 , m_shouldScrollOnMainThread(false) |
38 , m_haveWheelEventHandlers(false) | 39 , m_haveWheelEventHandlers(false) |
39 , m_nonFastScrollableRegionChanged(false) | 40 , m_nonFastScrollableRegionChanged(false) |
40 , m_touchEventHandlerRegionChanged(false) | 41 , m_touchEventHandlerRegionChanged(false) |
41 , m_anchorPoint(0.5, 0.5) | 42 , m_anchorPoint(0.5, 0.5) |
42 , m_backgroundColor(0) | 43 , m_backgroundColor(0) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (m_replicaLayer) | 93 if (m_replicaLayer) |
93 m_replicaLayer->setLayerTreeHost(host); | 94 m_replicaLayer->setLayerTreeHost(host); |
94 | 95 |
95 // If this layer already has active animations, the host needs to be notifie
d. | 96 // If this layer already has active animations, the host needs to be notifie
d. |
96 if (host && m_layerAnimationController->hasActiveAnimation()) | 97 if (host && m_layerAnimationController->hasActiveAnimation()) |
97 host->didAddAnimation(); | 98 host->didAddAnimation(); |
98 } | 99 } |
99 | 100 |
100 void Layer::setNeedsCommit() | 101 void Layer::setNeedsCommit() |
101 { | 102 { |
| 103 if (m_ignoreSetNeedsCommit) |
| 104 return; |
102 if (m_layerTreeHost) | 105 if (m_layerTreeHost) |
103 m_layerTreeHost->setNeedsCommit(); | 106 m_layerTreeHost->setNeedsCommit(); |
104 } | 107 } |
105 | 108 |
106 void Layer::setNeedsFullTreeSync() | 109 void Layer::setNeedsFullTreeSync() |
107 { | 110 { |
108 if (m_layerTreeHost) | 111 if (m_layerTreeHost) |
109 m_layerTreeHost->setNeedsFullTreeSync(); | 112 m_layerTreeHost->setNeedsFullTreeSync(); |
110 } | 113 } |
111 | 114 |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 m_debugName = debugName; | 650 m_debugName = debugName; |
648 setNeedsCommit(); | 651 setNeedsCommit(); |
649 } | 652 } |
650 | 653 |
651 void Layer::setRasterScale(float scale) | 654 void Layer::setRasterScale(float scale) |
652 { | 655 { |
653 if (m_rasterScale == scale) | 656 if (m_rasterScale == scale) |
654 return; | 657 return; |
655 m_rasterScale = scale; | 658 m_rasterScale = scale; |
656 | 659 |
657 if (!m_automaticallyComputeRasterScale) | 660 // When automatically computed, this acts like a draw property. |
| 661 if (m_automaticallyComputeRasterScale) |
658 return; | 662 return; |
659 setNeedsDisplay(); | 663 setNeedsDisplay(); |
660 } | 664 } |
661 | 665 |
662 void Layer::setAutomaticallyComputeRasterScale(bool automatic) | 666 void Layer::setAutomaticallyComputeRasterScale(bool automatic) |
663 { | 667 { |
664 if (m_automaticallyComputeRasterScale == automatic) | 668 if (m_automaticallyComputeRasterScale == automatic) |
665 return; | 669 return; |
666 m_automaticallyComputeRasterScale = automatic; | 670 m_automaticallyComputeRasterScale = automatic; |
667 | 671 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 { | 845 { |
842 return 0; | 846 return 0; |
843 } | 847 } |
844 | 848 |
845 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 849 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
846 { | 850 { |
847 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 851 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
848 } | 852 } |
849 | 853 |
850 } // namespace cc | 854 } // namespace cc |
OLD | NEW |