| 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 30 matching lines...) Expand all Loading... |
| 41 , m_anchorPoint(0.5, 0.5) | 41 , m_anchorPoint(0.5, 0.5) |
| 42 , m_backgroundColor(0) | 42 , m_backgroundColor(0) |
| 43 , m_opacity(1.0) | 43 , m_opacity(1.0) |
| 44 , m_anchorPointZ(0) | 44 , m_anchorPointZ(0) |
| 45 , m_isContainerForFixedPositionLayers(false) | 45 , m_isContainerForFixedPositionLayers(false) |
| 46 , m_fixedToContainerLayer(false) | 46 , m_fixedToContainerLayer(false) |
| 47 , m_isDrawable(false) | 47 , m_isDrawable(false) |
| 48 , m_masksToBounds(false) | 48 , m_masksToBounds(false) |
| 49 , m_contentsOpaque(false) | 49 , m_contentsOpaque(false) |
| 50 , m_doubleSided(true) | 50 , m_doubleSided(true) |
| 51 , m_useLCDText(false) | |
| 52 , m_preserves3D(false) | 51 , m_preserves3D(false) |
| 53 , m_useParentBackfaceVisibility(false) | 52 , m_useParentBackfaceVisibility(false) |
| 54 , m_drawCheckerboardForMissingTiles(false) | 53 , m_drawCheckerboardForMissingTiles(false) |
| 55 , m_forceRenderSurface(false) | 54 , m_forceRenderSurface(false) |
| 56 , m_replicaLayer(0) | 55 , m_replicaLayer(0) |
| 57 , m_rasterScale(1.0) | 56 , m_rasterScale(1.0) |
| 58 , m_automaticallyComputeRasterScale(false) | 57 , m_automaticallyComputeRasterScale(false) |
| 59 , m_boundsContainPageScale(false) | 58 , m_boundsContainPageScale(false) |
| 60 , m_layerAnimationDelegate(0) | 59 , m_layerAnimationDelegate(0) |
| 61 , m_layerScrollClient(0) | 60 , m_layerScrollClient(0) |
| 62 { | 61 { |
| 63 if (m_layerId < 0) { | 62 if (m_layerId < 0) { |
| 64 s_nextLayerId = 1; | 63 s_nextLayerId = 1; |
| 65 m_layerId = s_nextLayerId++; | 64 m_layerId = s_nextLayerId++; |
| 66 } | 65 } |
| 67 } | 66 } |
| 68 | 67 |
| 69 Layer::~Layer() | 68 Layer::~Layer() |
| 70 { | 69 { |
| 71 // Our parent should be holding a reference to us so there should be no | 70 // Our parent should be holding a reference to us so there should be no |
| 72 // way for us to be destroyed while we still have a parent. | 71 // way for us to be destroyed while we still have a parent. |
| 73 DCHECK(!parent()); | 72 DCHECK(!parent()); |
| 74 | 73 |
| 75 // Remove the parent reference from all children. | 74 // Remove the parent reference from all children. |
| 76 removeAllChildren(); | 75 removeAllChildren(); |
| 77 } | 76 } |
| 78 | 77 |
| 79 void Layer::setUseLCDText(bool useLCDText) | |
| 80 { | |
| 81 m_useLCDText = useLCDText; | |
| 82 } | |
| 83 | |
| 84 void Layer::setLayerTreeHost(LayerTreeHost* host) | 78 void Layer::setLayerTreeHost(LayerTreeHost* host) |
| 85 { | 79 { |
| 86 if (m_layerTreeHost == host) | 80 if (m_layerTreeHost == host) |
| 87 return; | 81 return; |
| 88 | 82 |
| 89 m_layerTreeHost = host; | 83 m_layerTreeHost = host; |
| 90 | 84 |
| 91 for (size_t i = 0; i < m_children.size(); ++i) | 85 for (size_t i = 0; i < m_children.size(); ++i) |
| 92 m_children[i]->setLayerTreeHost(host); | 86 m_children[i]->setLayerTreeHost(host); |
| 93 | 87 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 layer->setContentBounds(contentBounds()); | 554 layer->setContentBounds(contentBounds()); |
| 561 layer->setContentsScale(contentsScaleX(), contentsScaleY()); | 555 layer->setContentsScale(contentsScaleX(), contentsScaleY()); |
| 562 layer->setDebugName(m_debugName); | 556 layer->setDebugName(m_debugName); |
| 563 layer->setDoubleSided(m_doubleSided); | 557 layer->setDoubleSided(m_doubleSided); |
| 564 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; | 558 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; |
| 565 layer->setForceRenderSurface(m_forceRenderSurface); | 559 layer->setForceRenderSurface(m_forceRenderSurface); |
| 566 layer->setDrawsContent(drawsContent()); | 560 layer->setDrawsContent(drawsContent()); |
| 567 layer->setFilters(filters()); | 561 layer->setFilters(filters()); |
| 568 layer->setFilter(filter()); | 562 layer->setFilter(filter()); |
| 569 layer->setBackgroundFilters(backgroundFilters()); | 563 layer->setBackgroundFilters(backgroundFilters()); |
| 570 layer->setUseLCDText(m_useLCDText); | |
| 571 layer->setMasksToBounds(m_masksToBounds); | 564 layer->setMasksToBounds(m_masksToBounds); |
| 572 layer->setScrollable(m_scrollable); | 565 layer->setScrollable(m_scrollable); |
| 573 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); | 566 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); |
| 574 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); | 567 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); |
| 575 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be | 568 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be |
| 576 // arbitrarily large depending on page content, so we only push the property
if it's changed. | 569 // arbitrarily large depending on page content, so we only push the property
if it's changed. |
| 577 if (m_nonFastScrollableRegionChanged) { | 570 if (m_nonFastScrollableRegionChanged) { |
| 578 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); | 571 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); |
| 579 m_nonFastScrollableRegionChanged = false; | 572 m_nonFastScrollableRegionChanged = false; |
| 580 } | 573 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 { | 833 { |
| 841 return 0; | 834 return 0; |
| 842 } | 835 } |
| 843 | 836 |
| 844 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 837 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
| 845 { | 838 { |
| 846 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 839 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
| 847 } | 840 } |
| 848 | 841 |
| 849 } // namespace cc | 842 } // namespace cc |
| OLD | NEW |