| 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 return 0.f; | 848 return 0.f; |
| 849 | 849 |
| 850 const EffectNode* target_node = | 850 const EffectNode* target_node = |
| 851 tree.Node(layer->render_target()->EffectTreeIndex()); | 851 tree.Node(layer->render_target()->EffectTreeIndex()); |
| 852 const EffectNode* node = tree.Node(layer->effect_tree_index()); | 852 const EffectNode* node = tree.Node(layer->effect_tree_index()); |
| 853 if (node == target_node) | 853 if (node == target_node) |
| 854 return 1.f; | 854 return 1.f; |
| 855 | 855 |
| 856 float draw_opacity = 1.f; | 856 float draw_opacity = 1.f; |
| 857 while (node != target_node) { | 857 while (node != target_node) { |
| 858 draw_opacity *= node->data.opacity; | 858 draw_opacity *= tree.EffectiveOpacity(node); |
| 859 node = tree.parent(node); | 859 node = tree.parent(node); |
| 860 } | 860 } |
| 861 return draw_opacity; | 861 return draw_opacity; |
| 862 } | 862 } |
| 863 | 863 |
| 864 static void SetSurfaceDrawOpacity(const EffectTree& tree, | 864 static void SetSurfaceDrawOpacity(const EffectTree& tree, |
| 865 RenderSurfaceImpl* render_surface) { | 865 RenderSurfaceImpl* render_surface) { |
| 866 // Draw opacity of a surface is the product of opacities between the surface | 866 // Draw opacity of a surface is the product of opacities between the surface |
| 867 // (included) and its target surface (excluded). | 867 // (included) and its target surface (excluded). |
| 868 const EffectNode* node = tree.Node(render_surface->EffectTreeIndex()); | 868 const EffectNode* node = tree.Node(render_surface->EffectTreeIndex()); |
| 869 float draw_opacity = node->data.opacity; | 869 float draw_opacity = tree.EffectiveOpacity(node); |
| 870 for (node = tree.parent(node); node && !node->data.has_render_surface; | 870 for (node = tree.parent(node); node && !node->data.has_render_surface; |
| 871 node = tree.parent(node)) { | 871 node = tree.parent(node)) { |
| 872 draw_opacity *= node->data.opacity; | 872 draw_opacity *= tree.EffectiveOpacity(node); |
| 873 } | 873 } |
| 874 render_surface->SetDrawOpacity(draw_opacity); | 874 render_surface->SetDrawOpacity(draw_opacity); |
| 875 } | 875 } |
| 876 | 876 |
| 877 static bool LayerCanUseLcdText(const LayerImpl* layer, | 877 static bool LayerCanUseLcdText(const LayerImpl* layer, |
| 878 bool layers_always_allowed_lcd_text, | 878 bool layers_always_allowed_lcd_text, |
| 879 bool can_use_lcd_text, | 879 bool can_use_lcd_text, |
| 880 const TransformNode* transform_node, | 880 const TransformNode* transform_node, |
| 881 const EffectNode* effect_node) { | 881 const EffectNode* effect_node) { |
| 882 if (layers_always_allowed_lcd_text) | 882 if (layers_always_allowed_lcd_text) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 void UpdateElasticOverscroll(PropertyTrees* property_trees, | 1113 void UpdateElasticOverscroll(PropertyTrees* property_trees, |
| 1114 const Layer* overscroll_elasticity_layer, | 1114 const Layer* overscroll_elasticity_layer, |
| 1115 const gfx::Vector2dF& elastic_overscroll) { | 1115 const gfx::Vector2dF& elastic_overscroll) { |
| 1116 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, | 1116 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, |
| 1117 elastic_overscroll); | 1117 elastic_overscroll); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 } // namespace draw_property_utils | 1120 } // namespace draw_property_utils |
| 1121 | 1121 |
| 1122 } // namespace cc | 1122 } // namespace cc |
| OLD | NEW |