| 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 auto iterator = property_trees()->element_id_to_effect_node_index.find(id); | 856 auto iterator = property_trees()->element_id_to_effect_node_index.find(id); |
| 857 if (iterator == property_trees()->element_id_to_effect_node_index.end()) | 857 if (iterator == property_trees()->element_id_to_effect_node_index.end()) |
| 858 return nullptr; | 858 return nullptr; |
| 859 | 859 |
| 860 return Node(iterator->second); | 860 return Node(iterator->second); |
| 861 } | 861 } |
| 862 | 862 |
| 863 bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) { | 863 bool EffectTree::OnOpacityAnimated(ElementId id, float opacity) { |
| 864 EffectNode* node = FindNodeFromElementId(id); | 864 EffectNode* node = FindNodeFromElementId(id); |
| 865 DCHECK(node); | 865 DCHECK(node); |
| 866 // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is | |
| 867 // calling this without setting element id. | |
| 868 if (!node) | |
| 869 return false; | |
| 870 | |
| 871 if (node->opacity == opacity) | 866 if (node->opacity == opacity) |
| 872 return false; | 867 return false; |
| 873 node->opacity = opacity; | 868 node->opacity = opacity; |
| 874 node->effect_changed = true; | 869 node->effect_changed = true; |
| 875 property_trees()->changed = true; | 870 property_trees()->changed = true; |
| 876 property_trees()->effect_tree.set_needs_update(true); | 871 property_trees()->effect_tree.set_needs_update(true); |
| 877 return true; | 872 return true; |
| 878 } | 873 } |
| 879 | 874 |
| 880 bool EffectTree::OnFilterAnimated(ElementId id, | 875 bool EffectTree::OnFilterAnimated(ElementId id, |
| 881 const FilterOperations& filters) { | 876 const FilterOperations& filters) { |
| 882 EffectNode* node = FindNodeFromElementId(id); | 877 EffectNode* node = FindNodeFromElementId(id); |
| 883 DCHECK(node); | 878 DCHECK(node); |
| 884 // TODO(crbug.com/706766): Avoid crash. Need more investigation for what is | |
| 885 // calling this without setting element id. | |
| 886 if (!node) | |
| 887 return false; | |
| 888 | |
| 889 if (node->filters == filters) | 879 if (node->filters == filters) |
| 890 return false; | 880 return false; |
| 891 node->filters = filters; | 881 node->filters = filters; |
| 892 node->effect_changed = true; | 882 node->effect_changed = true; |
| 893 property_trees()->changed = true; | 883 property_trees()->changed = true; |
| 894 property_trees()->effect_tree.set_needs_update(true); | 884 property_trees()->effect_tree.set_needs_update(true); |
| 895 return true; | 885 return true; |
| 896 } | 886 } |
| 897 | 887 |
| 898 void EffectTree::UpdateEffects(int id) { | 888 void EffectTree::UpdateEffects(int id) { |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 const EffectNode* effect_node = effect_tree.Node(effect_id); | 2111 const EffectNode* effect_node = effect_tree.Node(effect_id); |
| 2122 | 2112 |
| 2123 if (effect_node->surface_contents_scale.x() != 0.0 && | 2113 if (effect_node->surface_contents_scale.x() != 0.0 && |
| 2124 effect_node->surface_contents_scale.y() != 0.0) | 2114 effect_node->surface_contents_scale.y() != 0.0) |
| 2125 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), | 2115 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), |
| 2126 1.0 / effect_node->surface_contents_scale.y()); | 2116 1.0 / effect_node->surface_contents_scale.y()); |
| 2127 return screen_space_transform; | 2117 return screen_space_transform; |
| 2128 } | 2118 } |
| 2129 | 2119 |
| 2130 } // namespace cc | 2120 } // namespace cc |
| OLD | NEW |