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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 } | 971 } |
972 | 972 |
973 bool EffectTree::HasCopyRequests() const { | 973 bool EffectTree::HasCopyRequests() const { |
974 return !copy_requests_.empty(); | 974 return !copy_requests_.empty(); |
975 } | 975 } |
976 | 976 |
977 void EffectTree::ClearCopyRequests() { | 977 void EffectTree::ClearCopyRequests() { |
978 for (auto& node : nodes()) { | 978 for (auto& node : nodes()) { |
979 node.subtree_has_copy_request = false; | 979 node.subtree_has_copy_request = false; |
980 node.has_copy_request = false; | 980 node.has_copy_request = false; |
| 981 node.closest_ancestor_with_copy_request_id = EffectTree::kInvalidNodeId; |
981 } | 982 } |
982 | 983 |
983 // Any copy requests that are still left will be aborted (sending an empty | 984 // Any copy requests that are still left will be aborted (sending an empty |
984 // result) on destruction. | 985 // result) on destruction. |
985 copy_requests_.clear(); | 986 copy_requests_.clear(); |
986 set_needs_update(true); | 987 set_needs_update(true); |
987 } | 988 } |
988 | 989 |
989 int EffectTree::ClosestAncestorWithCopyRequest(int id) const { | |
990 DCHECK_GE(id, EffectTree::kRootNodeId); | |
991 const EffectNode* node = Node(id); | |
992 while (node->id > EffectTree::kContentsRootNodeId) { | |
993 if (node->has_copy_request) | |
994 return node->id; | |
995 | |
996 node = parent(node); | |
997 } | |
998 | |
999 if (node->has_copy_request) | |
1000 return node->id; | |
1001 else | |
1002 return EffectTree::kInvalidNodeId; | |
1003 } | |
1004 | |
1005 int EffectTree::LowestCommonAncestorWithRenderSurface(int id_1, | 990 int EffectTree::LowestCommonAncestorWithRenderSurface(int id_1, |
1006 int id_2) const { | 991 int id_2) const { |
1007 DCHECK(GetRenderSurface(id_1)); | 992 DCHECK(GetRenderSurface(id_1)); |
1008 DCHECK(GetRenderSurface(id_2)); | 993 DCHECK(GetRenderSurface(id_2)); |
1009 while (id_1 != id_2) { | 994 while (id_1 != id_2) { |
1010 if (id_1 < id_2) | 995 if (id_1 < id_2) |
1011 id_2 = Node(id_2)->target_id; | 996 id_2 = Node(id_2)->target_id; |
1012 else | 997 else |
1013 id_1 = Node(id_1)->target_id; | 998 id_1 = Node(id_1)->target_id; |
1014 } | 999 } |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2142 const EffectNode* effect_node = effect_tree.Node(effect_id); | 2127 const EffectNode* effect_node = effect_tree.Node(effect_id); |
2143 | 2128 |
2144 if (effect_node->surface_contents_scale.x() != 0.0 && | 2129 if (effect_node->surface_contents_scale.x() != 0.0 && |
2145 effect_node->surface_contents_scale.y() != 0.0) | 2130 effect_node->surface_contents_scale.y() != 0.0) |
2146 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), | 2131 screen_space_transform.Scale(1.0 / effect_node->surface_contents_scale.x(), |
2147 1.0 / effect_node->surface_contents_scale.y()); | 2132 1.0 / effect_node->surface_contents_scale.y()); |
2148 return screen_space_transform; | 2133 return screen_space_transform; |
2149 } | 2134 } |
2150 | 2135 |
2151 } // namespace cc | 2136 } // namespace cc |
OLD | NEW |