| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 auto iterator = property_trees()->element_id_to_effect_node_index.find(id); | 863 auto iterator = property_trees()->element_id_to_effect_node_index.find(id); |
| 864 if (iterator == property_trees()->element_id_to_effect_node_index.end()) | 864 if (iterator == property_trees()->element_id_to_effect_node_index.end()) |
| 865 return nullptr; | 865 return nullptr; |
| 866 | 866 |
| 867 return Node(iterator->second); | 867 return Node(iterator->second); |
| 868 } | 868 } |
| 869 | 869 |
| 870 bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) { | 870 bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) { |
| 871 EffectNode* node = FindNodeFromElementId(id); | 871 EffectNode* node = FindNodeFromElementId(id); |
| 872 DCHECK(node); | 872 DCHECK(node); |
| 873 // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is | |
| 874 // calling this without setting element id. | |
| 875 if (!node) | |
| 876 return false; | |
| 877 | |
| 878 if (node->opacity == opacity) | 873 if (node->opacity == opacity) |
| 879 return false; | 874 return false; |
| 880 node->opacity = opacity; | 875 node->opacity = opacity; |
| 881 node->effect_changed = true; | 876 node->effect_changed = true; |
| 882 property_trees()->changed = true; | 877 property_trees()->changed = true; |
| 883 property_trees()->effect_tree.set_needs_update(true); | 878 property_trees()->effect_tree.set_needs_update(true); |
| 884 return true; | 879 return true; |
| 885 } | 880 } |
| 886 | 881 |
| 887 bool EffectTree::OnFilterAnimated(ElementId id, | 882 bool EffectTree::OnFilterAnimated(ElementId id, |
| 888 const FilterOperations& filters) { | 883 const FilterOperations& filters) { |
| 889 EffectNode* node = FindNodeFromElementId(id); | 884 EffectNode* node = FindNodeFromElementId(id); |
| 890 DCHECK(node); | 885 DCHECK(node); |
| 891 // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is | |
| 892 // calling this without setting element id. | |
| 893 if (!node) | |
| 894 return false; | |
| 895 | |
| 896 if (node->filters == filters) | 886 if (node->filters == filters) |
| 897 return false; | 887 return false; |
| 898 node->filters = filters; | 888 node->filters = filters; |
| 899 node->effect_changed = true; | 889 node->effect_changed = true; |
| 900 property_trees()->changed = true; | 890 property_trees()->changed = true; |
| 901 property_trees()->effect_tree.set_needs_update(true); | 891 property_trees()->effect_tree.set_needs_update(true); |
| 902 return true; | 892 return true; |
| 903 } | 893 } |
| 904 | 894 |
| 905 void EffectTree::UpdateEffects(int id) { | 895 void EffectTree::UpdateEffects(int id) { |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 const EffectNode* effect_node = effect_tree.Node(effect_id); | 2136 const EffectNode* effect_node = effect_tree.Node(effect_id); |
| 2147 | 2137 |
| 2148 if (effect_node->surface_contents_scale.x() != 0.0 && | 2138 if (effect_node->surface_contents_scale.x() != 0.0 && |
| 2149 effect_node->surface_contents_scale.y() != 0.0) | 2139 effect_node->surface_contents_scale.y() != 0.0) |
| 2150 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), | 2140 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), |
| 2151 1.0 / effect_node->surface_contents_scale.y()); | 2141 1.0 / effect_node->surface_contents_scale.y()); |
| 2152 return screen_space_transform; | 2142 return screen_space_transform; |
| 2153 } | 2143 } |
| 2154 | 2144 |
| 2155 } // namespace cc | 2145 } // namespace cc |
| OLD | NEW |