OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/draw_property_utils.h" | 5 #include "cc/trees/draw_property_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 float draw_opacity = 1.f; | 908 float draw_opacity = 1.f; |
909 while (node != target_node) { | 909 while (node != target_node) { |
910 draw_opacity *= node->data.opacity; | 910 draw_opacity *= node->data.opacity; |
911 node = tree.parent(node); | 911 node = tree.parent(node); |
912 } | 912 } |
913 return draw_opacity; | 913 return draw_opacity; |
914 } | 914 } |
915 | 915 |
916 static float SurfaceDrawOpacity(RenderSurfaceImpl* render_surface, | 916 static float SurfaceDrawOpacity(RenderSurfaceImpl* render_surface, |
917 const EffectTree& tree) { | 917 const EffectTree& tree) { |
| 918 // Draw opacity of a surface is the product of opacities between the surface |
| 919 // (included) and its target surface (excluded). |
918 const EffectNode* node = tree.Node(render_surface->EffectTreeIndex()); | 920 const EffectNode* node = tree.Node(render_surface->EffectTreeIndex()); |
919 float target_opacity_tree_index = render_surface->TargetEffectTreeIndex(); | 921 float draw_opacity = node->data.opacity; |
920 if (target_opacity_tree_index < 0) | 922 for (node = tree.parent(node); node && !node->data.has_render_surface; |
921 return node->data.screen_space_opacity; | 923 node = tree.parent(node)) { |
922 const EffectNode* target_node = tree.Node(target_opacity_tree_index); | |
923 float draw_opacity = 1.f; | |
924 while (node != target_node) { | |
925 draw_opacity *= node->data.opacity; | 924 draw_opacity *= node->data.opacity; |
926 node = tree.parent(node); | |
927 } | 925 } |
928 return draw_opacity; | 926 return draw_opacity; |
929 } | 927 } |
930 | 928 |
931 static bool LayerCanUseLcdText(const LayerImpl* layer, | 929 static bool LayerCanUseLcdText(const LayerImpl* layer, |
932 bool layers_always_allowed_lcd_text, | 930 bool layers_always_allowed_lcd_text, |
933 bool can_use_lcd_text, | 931 bool can_use_lcd_text, |
934 const TransformNode* transform_node, | 932 const TransformNode* transform_node, |
935 const EffectNode* effect_node) { | 933 const EffectNode* effect_node) { |
936 if (layers_always_allowed_lcd_text) | 934 if (layers_always_allowed_lcd_text) |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1176 |
1179 void UpdateElasticOverscrollInPropertyTrees( | 1177 void UpdateElasticOverscrollInPropertyTrees( |
1180 PropertyTrees* property_trees, | 1178 PropertyTrees* property_trees, |
1181 const Layer* overscroll_elasticity_layer, | 1179 const Layer* overscroll_elasticity_layer, |
1182 const gfx::Vector2dF& elastic_overscroll) { | 1180 const gfx::Vector2dF& elastic_overscroll) { |
1183 UpdateElasticOverscrollInPropertyTreesInternal( | 1181 UpdateElasticOverscrollInPropertyTreesInternal( |
1184 property_trees, overscroll_elasticity_layer, elastic_overscroll); | 1182 property_trees, overscroll_elasticity_layer, elastic_overscroll); |
1185 } | 1183 } |
1186 | 1184 |
1187 } // namespace cc | 1185 } // namespace cc |
OLD | NEW |