| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 , m_debugBorderWidth(0) | 46 , m_debugBorderWidth(0) |
| 47 , m_opacity(1.0) | 47 , m_opacity(1.0) |
| 48 , m_filter(0) | 48 , m_filter(0) |
| 49 , m_anchorPointZ(0) | 49 , m_anchorPointZ(0) |
| 50 , m_isContainerForFixedPositionLayers(false) | 50 , m_isContainerForFixedPositionLayers(false) |
| 51 , m_fixedToContainerLayer(false) | 51 , m_fixedToContainerLayer(false) |
| 52 , m_isDrawable(false) | 52 , m_isDrawable(false) |
| 53 , m_masksToBounds(false) | 53 , m_masksToBounds(false) |
| 54 , m_contentsOpaque(false) | 54 , m_contentsOpaque(false) |
| 55 , m_doubleSided(true) | 55 , m_doubleSided(true) |
| 56 , m_useLCDText(false) | 56 , m_canUseLCDText(false) |
| 57 , m_preserves3D(false) | 57 , m_preserves3D(false) |
| 58 , m_useParentBackfaceVisibility(false) | 58 , m_useParentBackfaceVisibility(false) |
| 59 , m_drawCheckerboardForMissingTiles(false) | 59 , m_drawCheckerboardForMissingTiles(false) |
| 60 , m_forceRenderSurface(false) | 60 , m_forceRenderSurface(false) |
| 61 , m_replicaLayer(0) | 61 , m_replicaLayer(0) |
| 62 , m_drawOpacity(0) | 62 , m_drawOpacity(0) |
| 63 , m_drawOpacityIsAnimating(false) | 63 , m_drawOpacityIsAnimating(false) |
| 64 , m_screenSpaceOpacityIsAnimating(false) |
| 64 , m_renderTarget(0) | 65 , m_renderTarget(0) |
| 65 , m_drawTransformIsAnimating(false) | 66 , m_drawTransformIsAnimating(false) |
| 66 , m_screenSpaceTransformIsAnimating(false) | 67 , m_screenSpaceTransformIsAnimating(false) |
| 67 , m_rasterScale(1.0) | 68 , m_rasterScale(1.0) |
| 68 , m_automaticallyComputeRasterScale(false) | 69 , m_automaticallyComputeRasterScale(false) |
| 69 , m_boundsContainPageScale(false) | 70 , m_boundsContainPageScale(false) |
| 70 , m_layerAnimationDelegate(0) | 71 , m_layerAnimationDelegate(0) |
| 71 , m_layerScrollClient(0) | 72 , m_layerScrollClient(0) |
| 72 { | 73 { |
| 73 if (m_layerId < 0) { | 74 if (m_layerId < 0) { |
| 74 s_nextLayerId = 1; | 75 s_nextLayerId = 1; |
| 75 m_layerId = s_nextLayerId++; | 76 m_layerId = s_nextLayerId++; |
| 76 } | 77 } |
| 77 } | 78 } |
| 78 | 79 |
| 79 Layer::~Layer() | 80 Layer::~Layer() |
| 80 { | 81 { |
| 81 // Our parent should be holding a reference to us so there should be no | 82 // Our parent should be holding a reference to us so there should be no |
| 82 // way for us to be destroyed while we still have a parent. | 83 // way for us to be destroyed while we still have a parent. |
| 83 DCHECK(!parent()); | 84 DCHECK(!parent()); |
| 84 | 85 |
| 85 // Remove the parent reference from all children. | 86 // Remove the parent reference from all children. |
| 86 removeAllChildren(); | 87 removeAllChildren(); |
| 87 | 88 |
| 88 SkSafeUnref(m_filter); | 89 SkSafeUnref(m_filter); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void Layer::setUseLCDText(bool useLCDText) | 92 void Layer::setCanUseLCDText(bool useLCDText) |
| 92 { | 93 { |
| 93 m_useLCDText = useLCDText; | 94 m_canUseLCDText = useLCDText; |
| 94 } | 95 } |
| 95 | 96 |
| 96 void Layer::setLayerTreeHost(LayerTreeHost* host) | 97 void Layer::setLayerTreeHost(LayerTreeHost* host) |
| 97 { | 98 { |
| 98 if (m_layerTreeHost == host) | 99 if (m_layerTreeHost == host) |
| 99 return; | 100 return; |
| 100 | 101 |
| 101 m_layerTreeHost = host; | 102 m_layerTreeHost = host; |
| 102 | 103 |
| 103 for (size_t i = 0; i < m_children.size(); ++i) | 104 for (size_t i = 0; i < m_children.size(); ++i) |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 layer->setDebugBorderColor(m_debugBorderColor); | 569 layer->setDebugBorderColor(m_debugBorderColor); |
| 569 layer->setDebugBorderWidth(m_debugBorderWidth); | 570 layer->setDebugBorderWidth(m_debugBorderWidth); |
| 570 layer->setDebugName(m_debugName); | 571 layer->setDebugName(m_debugName); |
| 571 layer->setDoubleSided(m_doubleSided); | 572 layer->setDoubleSided(m_doubleSided); |
| 572 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; | 573 layer->setDrawCheckerboardForMissingTiles(m_drawCheckerboardForMissingTiles)
; |
| 573 layer->setForceRenderSurface(m_forceRenderSurface); | 574 layer->setForceRenderSurface(m_forceRenderSurface); |
| 574 layer->setDrawsContent(drawsContent()); | 575 layer->setDrawsContent(drawsContent()); |
| 575 layer->setFilters(filters()); | 576 layer->setFilters(filters()); |
| 576 layer->setFilter(filter()); | 577 layer->setFilter(filter()); |
| 577 layer->setBackgroundFilters(backgroundFilters()); | 578 layer->setBackgroundFilters(backgroundFilters()); |
| 578 layer->setUseLCDText(m_useLCDText); | 579 layer->setCanUseLCDText(m_canUseLCDText); |
| 579 layer->setMasksToBounds(m_masksToBounds); | 580 layer->setMasksToBounds(m_masksToBounds); |
| 580 layer->setScrollable(m_scrollable); | 581 layer->setScrollable(m_scrollable); |
| 581 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); | 582 layer->setShouldScrollOnMainThread(m_shouldScrollOnMainThread); |
| 582 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); | 583 layer->setHaveWheelEventHandlers(m_haveWheelEventHandlers); |
| 583 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be | 584 // Copying a Region is more expensive than most layer properties, since it i
nvolves copying two Vectors that may be |
| 584 // arbitrarily large depending on page content, so we only push the property
if it's changed. | 585 // arbitrarily large depending on page content, so we only push the property
if it's changed. |
| 585 if (m_nonFastScrollableRegionChanged) { | 586 if (m_nonFastScrollableRegionChanged) { |
| 586 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); | 587 layer->setNonFastScrollableRegion(m_nonFastScrollableRegion); |
| 587 m_nonFastScrollableRegionChanged = false; | 588 m_nonFastScrollableRegionChanged = false; |
| 588 } | 589 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 { | 850 { |
| 850 return 0; | 851 return 0; |
| 851 } | 852 } |
| 852 | 853 |
| 853 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) | 854 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped
_refptr<Layer> >::iterator, void*) |
| 854 { | 855 { |
| 855 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. | 856 // Currently we don't use z-order to decide what to paint, so there's no nee
d to actually sort Layers. |
| 856 } | 857 } |
| 857 | 858 |
| 858 } // namespace cc | 859 } // namespace cc |
| OLD | NEW |