| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 } | 956 } |
| 957 | 957 |
| 958 if (it.represents_contributing_render_surface()) { | 958 if (it.represents_contributing_render_surface()) { |
| 959 // Surfaces aren't used by the tile raster code, so they can have | 959 // Surfaces aren't used by the tile raster code, so they can have |
| 960 // occlusion regardless of replicas. | 960 // occlusion regardless of replicas. |
| 961 const RenderSurfaceImpl* occlusion_surface = | 961 const RenderSurfaceImpl* occlusion_surface = |
| 962 occlusion_tracker.OcclusionSurfaceForContributingSurface(); | 962 occlusion_tracker.OcclusionSurfaceForContributingSurface(); |
| 963 gfx::Transform draw_transform; | 963 gfx::Transform draw_transform; |
| 964 if (occlusion_surface) { | 964 if (occlusion_surface) { |
| 965 // We are calculating transform between two render surfaces. So, we | 965 // We are calculating transform between two render surfaces. So, we |
| 966 // need to apply the sublayer scale at target and remove the sublayer | 966 // need to apply the surface contents scale at target and remove the |
| 967 // scale at source. | 967 // surface contents scale at source. |
| 968 property_trees()->transform_tree.ComputeTransform( | 968 property_trees()->transform_tree.ComputeTransform( |
| 969 it->render_surface()->TransformTreeIndex(), | 969 it->render_surface()->TransformTreeIndex(), |
| 970 occlusion_surface->TransformTreeIndex(), &draw_transform); | 970 occlusion_surface->TransformTreeIndex(), &draw_transform); |
| 971 // We don't have to apply sublayer scale when target is root. | 971 // We don't have to apply surface contents scale when target is root. |
| 972 if (occlusion_surface->TransformTreeIndex() != 0) { | 972 if (occlusion_surface->TransformTreeIndex() != 0) { |
| 973 draw_property_utils::PostConcatSublayerScale( | 973 const EffectNode* occlusion_effect_node = |
| 974 occlusion_surface->EffectTreeIndex(), | 974 property_trees()->effect_tree.Node( |
| 975 property_trees()->effect_tree, &draw_transform); | 975 occlusion_surface->EffectTreeIndex()); |
| 976 draw_property_utils::PostConcatSurfaceContentsScale( |
| 977 occlusion_effect_node, &draw_transform); |
| 976 } | 978 } |
| 977 draw_property_utils::ConcatInverseSublayerScale( | 979 const EffectNode* effect_node = property_trees()->effect_tree.Node( |
| 978 it->render_surface()->EffectTreeIndex(), | 980 it->render_surface()->EffectTreeIndex()); |
| 979 property_trees()->effect_tree, &draw_transform); | 981 draw_property_utils::ConcatInverseSurfaceContentsScale( |
| 982 effect_node, &draw_transform); |
| 980 } | 983 } |
| 981 | 984 |
| 982 Occlusion occlusion = | 985 Occlusion occlusion = |
| 983 occlusion_tracker.GetCurrentOcclusionForContributingSurface( | 986 occlusion_tracker.GetCurrentOcclusionForContributingSurface( |
| 984 draw_transform); | 987 draw_transform); |
| 985 it->render_surface()->set_occlusion_in_content_space(occlusion); | 988 it->render_surface()->set_occlusion_in_content_space(occlusion); |
| 986 // Masks are used to draw the contributing surface, so should have | 989 // Masks are used to draw the contributing surface, so should have |
| 987 // the same occlusion as the surface (nothing inside the surface | 990 // the same occlusion as the surface (nothing inside the surface |
| 988 // occludes them). | 991 // occludes them). |
| 989 if (LayerImpl* mask = it->render_surface()->MaskLayer()) { | 992 if (LayerImpl* mask = it->render_surface()->MaskLayer()) { |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 return layer_space_region.Contains( | 1660 return layer_space_region.Contains( |
| 1658 gfx::ToRoundedPoint(hit_test_point_in_layer_space)); | 1661 gfx::ToRoundedPoint(hit_test_point_in_layer_space)); |
| 1659 } | 1662 } |
| 1660 | 1663 |
| 1661 static const gfx::Transform SurfaceScreenSpaceTransform( | 1664 static const gfx::Transform SurfaceScreenSpaceTransform( |
| 1662 const LayerImpl* layer, | 1665 const LayerImpl* layer, |
| 1663 const TransformTree& transform_tree) { | 1666 const TransformTree& transform_tree) { |
| 1664 DCHECK(layer->render_surface()); | 1667 DCHECK(layer->render_surface()); |
| 1665 return layer->is_drawn_render_surface_layer_list_member() | 1668 return layer->is_drawn_render_surface_layer_list_member() |
| 1666 ? layer->render_surface()->screen_space_transform() | 1669 ? layer->render_surface()->screen_space_transform() |
| 1667 : transform_tree.ToScreenSpaceTransformWithoutSublayerScale( | 1670 : transform_tree.ToScreenSpaceTransformWithoutSurfaceContentsScale( |
| 1668 layer->render_surface()->TransformTreeIndex()); | 1671 layer->render_surface()->TransformTreeIndex()); |
| 1669 } | 1672 } |
| 1670 | 1673 |
| 1671 static bool PointIsClippedByAncestorClipNode( | 1674 static bool PointIsClippedByAncestorClipNode( |
| 1672 const gfx::PointF& screen_space_point, | 1675 const gfx::PointF& screen_space_point, |
| 1673 const LayerImpl* layer, | 1676 const LayerImpl* layer, |
| 1674 const ClipTree& clip_tree, | 1677 const ClipTree& clip_tree, |
| 1675 const TransformTree& transform_tree) { | 1678 const TransformTree& transform_tree) { |
| 1676 // We need to visit all ancestor clip nodes to check this. Checking with just | 1679 // We need to visit all ancestor clip nodes to check this. Checking with just |
| 1677 // the combined clip stored at a clip node is not enough because parent | 1680 // the combined clip stored at a clip node is not enough because parent |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 | 2015 |
| 2013 void LayerTreeImpl::ResetAllChangeTracking() { | 2016 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2014 layers_that_should_push_properties_.clear(); | 2017 layers_that_should_push_properties_.clear(); |
| 2015 // Iterate over all layers, including masks and replicas. | 2018 // Iterate over all layers, including masks and replicas. |
| 2016 for (auto& layer : *layers_) | 2019 for (auto& layer : *layers_) |
| 2017 layer->ResetChangeTracking(); | 2020 layer->ResetChangeTracking(); |
| 2018 property_trees_.ResetAllChangeTracking(); | 2021 property_trees_.ResetAllChangeTracking(); |
| 2019 } | 2022 } |
| 2020 | 2023 |
| 2021 } // namespace cc | 2024 } // namespace cc |
| OLD | NEW |