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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 Occlusion occlusion = | 951 Occlusion occlusion = |
952 inside_replica ? Occlusion() | 952 inside_replica ? Occlusion() |
953 : occlusion_tracker.GetCurrentOcclusionForLayer( | 953 : occlusion_tracker.GetCurrentOcclusionForLayer( |
954 it->DrawTransform()); | 954 it->DrawTransform()); |
955 it->draw_properties().occlusion_in_content_space = occlusion; | 955 it->draw_properties().occlusion_in_content_space = occlusion; |
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 = |
| 962 occlusion_tracker.OcclusionSurfaceForContributingSurface(); |
| 963 gfx::Transform draw_transform; |
| 964 if (occlusion_surface) { |
| 965 // We are calculating transform between two render surfaces. So, we |
| 966 // need to apply the sublayer scale at target and remove the sublayer |
| 967 // scale at source. |
| 968 property_trees()->transform_tree.ComputeTransform( |
| 969 it->render_surface()->TransformTreeIndex(), |
| 970 occlusion_surface->TransformTreeIndex(), &draw_transform); |
| 971 // We don't have to apply sublayer scale when target is root. |
| 972 if (occlusion_surface->TransformTreeIndex() != 0) { |
| 973 draw_property_utils::PostConcatSublayerScale( |
| 974 occlusion_surface->EffectTreeIndex(), |
| 975 property_trees()->effect_tree, &draw_transform); |
| 976 } |
| 977 draw_property_utils::ConcatInverseSublayerScale( |
| 978 it->render_surface()->EffectTreeIndex(), |
| 979 property_trees()->effect_tree, &draw_transform); |
| 980 } |
| 981 |
961 Occlusion occlusion = | 982 Occlusion occlusion = |
962 occlusion_tracker.GetCurrentOcclusionForContributingSurface( | 983 occlusion_tracker.GetCurrentOcclusionForContributingSurface( |
963 it->render_surface()->draw_transform()); | 984 draw_transform); |
964 it->render_surface()->set_occlusion_in_content_space(occlusion); | 985 it->render_surface()->set_occlusion_in_content_space(occlusion); |
965 // Masks are used to draw the contributing surface, so should have | 986 // Masks are used to draw the contributing surface, so should have |
966 // the same occlusion as the surface (nothing inside the surface | 987 // the same occlusion as the surface (nothing inside the surface |
967 // occludes them). | 988 // occludes them). |
968 if (LayerImpl* mask = it->render_surface()->MaskLayer()) { | 989 if (LayerImpl* mask = it->render_surface()->MaskLayer()) { |
969 Occlusion mask_occlusion = | 990 Occlusion mask_occlusion = |
970 inside_replica | 991 inside_replica |
971 ? Occlusion() | 992 ? Occlusion() |
972 : occlusion_tracker.GetCurrentOcclusionForContributingSurface( | 993 : occlusion_tracker.GetCurrentOcclusionForContributingSurface( |
973 it->render_surface()->draw_transform() * | 994 draw_transform * it->DrawTransform()); |
974 it->DrawTransform()); | |
975 mask->draw_properties().occlusion_in_content_space = mask_occlusion; | 995 mask->draw_properties().occlusion_in_content_space = mask_occlusion; |
976 } | 996 } |
977 if (LayerImpl* replica_mask = | 997 if (LayerImpl* replica_mask = |
978 it->render_surface()->ReplicaMaskLayer()) { | 998 it->render_surface()->ReplicaMaskLayer()) { |
979 replica_mask->draw_properties().occlusion_in_content_space = | 999 replica_mask->draw_properties().occlusion_in_content_space = |
980 Occlusion(); | 1000 Occlusion(); |
981 } | 1001 } |
982 } | 1002 } |
983 | 1003 |
984 occlusion_tracker.LeaveLayer(it); | 1004 occlusion_tracker.LeaveLayer(it); |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 | 2012 |
1993 void LayerTreeImpl::ResetAllChangeTracking() { | 2013 void LayerTreeImpl::ResetAllChangeTracking() { |
1994 layers_that_should_push_properties_.clear(); | 2014 layers_that_should_push_properties_.clear(); |
1995 // Iterate over all layers, including masks and replicas. | 2015 // Iterate over all layers, including masks and replicas. |
1996 for (auto& layer : *layers_) | 2016 for (auto& layer : *layers_) |
1997 layer->ResetChangeTracking(); | 2017 layer->ResetChangeTracking(); |
1998 property_trees_.ResetAllChangeTracking(); | 2018 property_trees_.ResetAllChangeTracking(); |
1999 } | 2019 } |
2000 | 2020 |
2001 } // namespace cc | 2021 } // namespace cc |
OLD | NEW |