| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 TransformNodeData::TransformNodeData() | 158 TransformNodeData::TransformNodeData() |
| 159 : target_id(-1), | 159 : target_id(-1), |
| 160 content_target_id(-1), | 160 content_target_id(-1), |
| 161 source_node_id(-1), | 161 source_node_id(-1), |
| 162 sorting_context_id(0), | 162 sorting_context_id(0), |
| 163 needs_local_transform_update(true), | 163 needs_local_transform_update(true), |
| 164 node_and_ancestors_are_animated_or_invertible(true), | 164 node_and_ancestors_are_animated_or_invertible(true), |
| 165 is_invertible(true), | 165 is_invertible(true), |
| 166 ancestors_are_invertible(true), | 166 ancestors_are_invertible(true), |
| 167 is_animated(false), | 167 has_potential_animation(false), |
| 168 is_currently_animating(false), |
| 168 to_screen_is_potentially_animated(false), | 169 to_screen_is_potentially_animated(false), |
| 169 has_only_translation_animations(true), | 170 has_only_translation_animations(true), |
| 170 to_screen_has_scale_animation(false), | 171 to_screen_has_scale_animation(false), |
| 171 flattens_inherited_transform(false), | 172 flattens_inherited_transform(false), |
| 172 node_and_ancestors_are_flat(true), | 173 node_and_ancestors_are_flat(true), |
| 173 node_and_ancestors_have_only_integer_translation(true), | 174 node_and_ancestors_have_only_integer_translation(true), |
| 174 scrolls(false), | 175 scrolls(false), |
| 175 needs_sublayer_scale(false), | 176 needs_sublayer_scale(false), |
| 176 affected_by_inner_viewport_bounds_delta_x(false), | 177 affected_by_inner_viewport_bounds_delta_x(false), |
| 177 affected_by_inner_viewport_bounds_delta_y(false), | 178 affected_by_inner_viewport_bounds_delta_y(false), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 197 to_screen == other.to_screen && from_screen == other.from_screen && | 198 to_screen == other.to_screen && from_screen == other.from_screen && |
| 198 target_id == other.target_id && | 199 target_id == other.target_id && |
| 199 content_target_id == other.content_target_id && | 200 content_target_id == other.content_target_id && |
| 200 source_node_id == other.source_node_id && | 201 source_node_id == other.source_node_id && |
| 201 sorting_context_id == other.sorting_context_id && | 202 sorting_context_id == other.sorting_context_id && |
| 202 needs_local_transform_update == other.needs_local_transform_update && | 203 needs_local_transform_update == other.needs_local_transform_update && |
| 203 node_and_ancestors_are_animated_or_invertible == | 204 node_and_ancestors_are_animated_or_invertible == |
| 204 other.node_and_ancestors_are_animated_or_invertible && | 205 other.node_and_ancestors_are_animated_or_invertible && |
| 205 is_invertible == other.is_invertible && | 206 is_invertible == other.is_invertible && |
| 206 ancestors_are_invertible == other.ancestors_are_invertible && | 207 ancestors_are_invertible == other.ancestors_are_invertible && |
| 207 is_animated == other.is_animated && | 208 has_potential_animation == other.has_potential_animation && |
| 209 is_currently_animating == other.is_currently_animating && |
| 208 to_screen_is_potentially_animated == | 210 to_screen_is_potentially_animated == |
| 209 other.to_screen_is_potentially_animated && | 211 other.to_screen_is_potentially_animated && |
| 210 has_only_translation_animations == | 212 has_only_translation_animations == |
| 211 other.has_only_translation_animations && | 213 other.has_only_translation_animations && |
| 212 to_screen_has_scale_animation == other.to_screen_has_scale_animation && | 214 to_screen_has_scale_animation == other.to_screen_has_scale_animation && |
| 213 flattens_inherited_transform == other.flattens_inherited_transform && | 215 flattens_inherited_transform == other.flattens_inherited_transform && |
| 214 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat && | 216 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat && |
| 215 node_and_ancestors_have_only_integer_translation == | 217 node_and_ancestors_have_only_integer_translation == |
| 216 other.node_and_ancestors_have_only_integer_translation && | 218 other.node_and_ancestors_have_only_integer_translation && |
| 217 scrolls == other.scrolls && | 219 scrolls == other.scrolls && |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 data->set_sorting_context_id(sorting_context_id); | 285 data->set_sorting_context_id(sorting_context_id); |
| 284 | 286 |
| 285 data->set_needs_local_transform_update(needs_local_transform_update); | 287 data->set_needs_local_transform_update(needs_local_transform_update); |
| 286 | 288 |
| 287 data->set_node_and_ancestors_are_animated_or_invertible( | 289 data->set_node_and_ancestors_are_animated_or_invertible( |
| 288 node_and_ancestors_are_animated_or_invertible); | 290 node_and_ancestors_are_animated_or_invertible); |
| 289 | 291 |
| 290 data->set_is_invertible(is_invertible); | 292 data->set_is_invertible(is_invertible); |
| 291 data->set_ancestors_are_invertible(ancestors_are_invertible); | 293 data->set_ancestors_are_invertible(ancestors_are_invertible); |
| 292 | 294 |
| 293 data->set_is_animated(is_animated); | 295 data->set_has_potential_animation(has_potential_animation); |
| 296 data->set_is_currently_animating(is_currently_animating); |
| 294 data->set_to_screen_is_potentially_animated( | 297 data->set_to_screen_is_potentially_animated( |
| 295 to_screen_is_potentially_animated); | 298 to_screen_is_potentially_animated); |
| 296 data->set_has_only_translation_animations(has_only_translation_animations); | 299 data->set_has_only_translation_animations(has_only_translation_animations); |
| 297 data->set_to_screen_has_scale_animation(to_screen_has_scale_animation); | 300 data->set_to_screen_has_scale_animation(to_screen_has_scale_animation); |
| 298 | 301 |
| 299 data->set_flattens_inherited_transform(flattens_inherited_transform); | 302 data->set_flattens_inherited_transform(flattens_inherited_transform); |
| 300 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat); | 303 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat); |
| 301 | 304 |
| 302 data->set_node_and_ancestors_have_only_integer_translation( | 305 data->set_node_and_ancestors_have_only_integer_translation( |
| 303 node_and_ancestors_have_only_integer_translation); | 306 node_and_ancestors_have_only_integer_translation); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 sorting_context_id = data.sorting_context_id(); | 356 sorting_context_id = data.sorting_context_id(); |
| 354 | 357 |
| 355 needs_local_transform_update = data.needs_local_transform_update(); | 358 needs_local_transform_update = data.needs_local_transform_update(); |
| 356 | 359 |
| 357 node_and_ancestors_are_animated_or_invertible = | 360 node_and_ancestors_are_animated_or_invertible = |
| 358 data.node_and_ancestors_are_animated_or_invertible(); | 361 data.node_and_ancestors_are_animated_or_invertible(); |
| 359 | 362 |
| 360 is_invertible = data.is_invertible(); | 363 is_invertible = data.is_invertible(); |
| 361 ancestors_are_invertible = data.ancestors_are_invertible(); | 364 ancestors_are_invertible = data.ancestors_are_invertible(); |
| 362 | 365 |
| 363 is_animated = data.is_animated(); | 366 has_potential_animation = data.has_potential_animation(); |
| 367 is_currently_animating = data.is_currently_animating(); |
| 364 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated(); | 368 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated(); |
| 365 has_only_translation_animations = data.has_only_translation_animations(); | 369 has_only_translation_animations = data.has_only_translation_animations(); |
| 366 to_screen_has_scale_animation = data.to_screen_has_scale_animation(); | 370 to_screen_has_scale_animation = data.to_screen_has_scale_animation(); |
| 367 | 371 |
| 368 flattens_inherited_transform = data.flattens_inherited_transform(); | 372 flattens_inherited_transform = data.flattens_inherited_transform(); |
| 369 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat(); | 373 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat(); |
| 370 | 374 |
| 371 node_and_ancestors_have_only_integer_translation = | 375 node_and_ancestors_have_only_integer_translation = |
| 372 data.node_and_ancestors_have_only_integer_translation(); | 376 data.node_and_ancestors_have_only_integer_translation(); |
| 373 scrolls = data.scrolls(); | 377 scrolls = data.scrolls(); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 if (parent_node) { | 1022 if (parent_node) { |
| 1019 ancestor_is_animating = parent_node->data.to_screen_is_potentially_animated; | 1023 ancestor_is_animating = parent_node->data.to_screen_is_potentially_animated; |
| 1020 ancestor_is_animating_scale = | 1024 ancestor_is_animating_scale = |
| 1021 parent_node->data.to_screen_has_scale_animation; | 1025 parent_node->data.to_screen_has_scale_animation; |
| 1022 ancestor_maximum_target_scale = | 1026 ancestor_maximum_target_scale = |
| 1023 parent_node->data.combined_maximum_animation_target_scale; | 1027 parent_node->data.combined_maximum_animation_target_scale; |
| 1024 ancestor_starting_animation_scale = | 1028 ancestor_starting_animation_scale = |
| 1025 parent_node->data.combined_starting_animation_scale; | 1029 parent_node->data.combined_starting_animation_scale; |
| 1026 } | 1030 } |
| 1027 node->data.to_screen_is_potentially_animated = | 1031 node->data.to_screen_is_potentially_animated = |
| 1028 node->data.is_animated || ancestor_is_animating; | 1032 node->data.has_potential_animation || ancestor_is_animating; |
| 1029 node->data.to_screen_has_scale_animation = | 1033 node->data.to_screen_has_scale_animation = |
| 1030 !node->data.has_only_translation_animations || | 1034 !node->data.has_only_translation_animations || |
| 1031 ancestor_is_animating_scale; | 1035 ancestor_is_animating_scale; |
| 1032 | 1036 |
| 1033 // Once we've failed to compute a maximum animated scale at an ancestor, we | 1037 // Once we've failed to compute a maximum animated scale at an ancestor, we |
| 1034 // continue to fail. | 1038 // continue to fail. |
| 1035 bool failed_at_ancestor = | 1039 bool failed_at_ancestor = |
| 1036 ancestor_is_animating_scale && ancestor_maximum_target_scale == 0.f; | 1040 ancestor_is_animating_scale && ancestor_maximum_target_scale == 0.f; |
| 1037 | 1041 |
| 1038 // Computing maximum animated scale in the presence of non-scale/translation | 1042 // Computing maximum animated scale in the presence of non-scale/translation |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 if (source_node && source_node->id != parent_node->id && | 1157 if (source_node && source_node->id != parent_node->id && |
| 1154 source_to_parent_updates_allowed_ && source_node->data.transform_changed) | 1158 source_to_parent_updates_allowed_ && source_node->data.transform_changed) |
| 1155 node->data.transform_changed = true; | 1159 node->data.transform_changed = true; |
| 1156 } | 1160 } |
| 1157 | 1161 |
| 1158 void TransformTree::UpdateNodeAndAncestorsAreAnimatedOrInvertible( | 1162 void TransformTree::UpdateNodeAndAncestorsAreAnimatedOrInvertible( |
| 1159 TransformNode* node, | 1163 TransformNode* node, |
| 1160 TransformNode* parent_node) { | 1164 TransformNode* parent_node) { |
| 1161 if (!parent_node) { | 1165 if (!parent_node) { |
| 1162 node->data.node_and_ancestors_are_animated_or_invertible = | 1166 node->data.node_and_ancestors_are_animated_or_invertible = |
| 1163 node->data.is_animated || node->data.is_invertible; | 1167 node->data.has_potential_animation || node->data.is_invertible; |
| 1164 return; | 1168 return; |
| 1165 } | 1169 } |
| 1166 if (!parent_node->data.node_and_ancestors_are_animated_or_invertible) { | 1170 if (!parent_node->data.node_and_ancestors_are_animated_or_invertible) { |
| 1167 node->data.node_and_ancestors_are_animated_or_invertible = false; | 1171 node->data.node_and_ancestors_are_animated_or_invertible = false; |
| 1168 return; | 1172 return; |
| 1169 } | 1173 } |
| 1170 bool is_invertible = node->data.is_invertible; | 1174 bool is_invertible = node->data.is_invertible; |
| 1171 // Even when the current node's transform and the parent's screen space | 1175 // Even when the current node's transform and the parent's screen space |
| 1172 // transform are invertible, the current node's screen space transform can | 1176 // transform are invertible, the current node's screen space transform can |
| 1173 // become uninvertible due to floating-point arithmetic. | 1177 // become uninvertible due to floating-point arithmetic. |
| 1174 if (!node->data.ancestors_are_invertible && | 1178 if (!node->data.ancestors_are_invertible && |
| 1175 parent_node->data.ancestors_are_invertible) | 1179 parent_node->data.ancestors_are_invertible) |
| 1176 is_invertible = false; | 1180 is_invertible = false; |
| 1177 node->data.node_and_ancestors_are_animated_or_invertible = | 1181 node->data.node_and_ancestors_are_animated_or_invertible = |
| 1178 node->data.is_animated || is_invertible; | 1182 node->data.has_potential_animation || is_invertible; |
| 1179 } | 1183 } |
| 1180 | 1184 |
| 1181 void TransformTree::SetDeviceTransform(const gfx::Transform& transform, | 1185 void TransformTree::SetDeviceTransform(const gfx::Transform& transform, |
| 1182 gfx::PointF root_position) { | 1186 gfx::PointF root_position) { |
| 1183 gfx::Transform root_post_local = transform; | 1187 gfx::Transform root_post_local = transform; |
| 1184 TransformNode* node = Node(1); | 1188 TransformNode* node = Node(1); |
| 1185 root_post_local.Scale(node->data.post_local_scale_factor, | 1189 root_post_local.Scale(node->data.post_local_scale_factor, |
| 1186 node->data.post_local_scale_factor); | 1190 node->data.post_local_scale_factor); |
| 1187 root_post_local.Translate(root_position.x(), root_position.y()); | 1191 root_post_local.Translate(root_position.x(), root_position.y()); |
| 1188 if (node->data.post_local == root_post_local) | 1192 if (node->data.post_local == root_post_local) |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2098 value->EndDictionary(); | 2102 value->EndDictionary(); |
| 2099 | 2103 |
| 2100 value->BeginDictionary("scroll_tree"); | 2104 value->BeginDictionary("scroll_tree"); |
| 2101 scroll_tree.AsValueInto(value.get()); | 2105 scroll_tree.AsValueInto(value.get()); |
| 2102 value->EndDictionary(); | 2106 value->EndDictionary(); |
| 2103 | 2107 |
| 2104 return value; | 2108 return value; |
| 2105 } | 2109 } |
| 2106 | 2110 |
| 2107 } // namespace cc | 2111 } // namespace cc |
| OLD | NEW |