| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/trace_event/trace_event_argument.h" | 5 #include "base/trace_event/trace_event_argument.h" |
| 6 #include "cc/base/math_util.h" | 6 #include "cc/base/math_util.h" |
| 7 #include "cc/proto/gfx_conversions.h" | 7 #include "cc/proto/gfx_conversions.h" |
| 8 #include "cc/trees/transform_node.h" | 8 #include "cc/trees/transform_node.h" |
| 9 #include "ui/gfx/geometry/point3_f.h" | 9 #include "ui/gfx/geometry/point3_f.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 TransformNode::TransformNode() | 13 TransformNode::TransformNode() |
| 14 : id(-1), | 14 : id(-1), |
| 15 parent_id(-1), | 15 parent_id(-1), |
| 16 owner_id(-1), | 16 owning_layer_id(-1), |
| 17 sticky_position_constraint_id(-1), | 17 sticky_position_constraint_id(-1), |
| 18 source_node_id(-1), | 18 source_node_id(-1), |
| 19 sorting_context_id(0), | 19 sorting_context_id(0), |
| 20 needs_local_transform_update(true), | 20 needs_local_transform_update(true), |
| 21 node_and_ancestors_are_animated_or_invertible(true), | 21 node_and_ancestors_are_animated_or_invertible(true), |
| 22 is_invertible(true), | 22 is_invertible(true), |
| 23 ancestors_are_invertible(true), | 23 ancestors_are_invertible(true), |
| 24 has_potential_animation(false), | 24 has_potential_animation(false), |
| 25 is_currently_animating(false), | 25 is_currently_animating(false), |
| 26 to_screen_is_potentially_animated(false), | 26 to_screen_is_potentially_animated(false), |
| 27 has_only_translation_animations(true), | 27 has_only_translation_animations(true), |
| 28 flattens_inherited_transform(false), | 28 flattens_inherited_transform(false), |
| 29 node_and_ancestors_are_flat(true), | 29 node_and_ancestors_are_flat(true), |
| 30 node_and_ancestors_have_only_integer_translation(true), | 30 node_and_ancestors_have_only_integer_translation(true), |
| 31 scrolls(false), | 31 scrolls(false), |
| 32 should_be_snapped(false), | 32 should_be_snapped(false), |
| 33 moved_by_inner_viewport_bounds_delta_x(false), | 33 moved_by_inner_viewport_bounds_delta_x(false), |
| 34 moved_by_inner_viewport_bounds_delta_y(false), | 34 moved_by_inner_viewport_bounds_delta_y(false), |
| 35 moved_by_outer_viewport_bounds_delta_x(false), | 35 moved_by_outer_viewport_bounds_delta_x(false), |
| 36 moved_by_outer_viewport_bounds_delta_y(false), | 36 moved_by_outer_viewport_bounds_delta_y(false), |
| 37 in_subtree_of_page_scale_layer(false), | 37 in_subtree_of_page_scale_layer(false), |
| 38 transform_changed(false), | 38 transform_changed(false), |
| 39 post_local_scale_factor(1.0f) {} | 39 post_local_scale_factor(1.0f) {} |
| 40 | 40 |
| 41 TransformNode::TransformNode(const TransformNode&) = default; | 41 TransformNode::TransformNode(const TransformNode&) = default; |
| 42 | 42 |
| 43 bool TransformNode::operator==(const TransformNode& other) const { | 43 bool TransformNode::operator==(const TransformNode& other) const { |
| 44 return id == other.id && parent_id == other.parent_id && | 44 return id == other.id && parent_id == other.parent_id && |
| 45 owner_id == other.owner_id && pre_local == other.pre_local && | 45 owning_layer_id == other.owning_layer_id && |
| 46 local == other.local && post_local == other.post_local && | 46 pre_local == other.pre_local && local == other.local && |
| 47 to_parent == other.to_parent && | 47 post_local == other.post_local && to_parent == other.to_parent && |
| 48 source_node_id == other.source_node_id && | 48 source_node_id == other.source_node_id && |
| 49 sorting_context_id == other.sorting_context_id && | 49 sorting_context_id == other.sorting_context_id && |
| 50 needs_local_transform_update == other.needs_local_transform_update && | 50 needs_local_transform_update == other.needs_local_transform_update && |
| 51 node_and_ancestors_are_animated_or_invertible == | 51 node_and_ancestors_are_animated_or_invertible == |
| 52 other.node_and_ancestors_are_animated_or_invertible && | 52 other.node_and_ancestors_are_animated_or_invertible && |
| 53 is_invertible == other.is_invertible && | 53 is_invertible == other.is_invertible && |
| 54 ancestors_are_invertible == other.ancestors_are_invertible && | 54 ancestors_are_invertible == other.ancestors_are_invertible && |
| 55 has_potential_animation == other.has_potential_animation && | 55 has_potential_animation == other.has_potential_animation && |
| 56 is_currently_animating == other.is_currently_animating && | 56 is_currently_animating == other.is_currently_animating && |
| 57 to_screen_is_potentially_animated == | 57 to_screen_is_potentially_animated == |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 post_local.Scale(post_local_scale_factor, post_local_scale_factor); | 96 post_local.Scale(post_local_scale_factor, post_local_scale_factor); |
| 97 post_local.Translate3d( | 97 post_local.Translate3d( |
| 98 position.x() + source_offset.x() + transform_origin.x(), | 98 position.x() + source_offset.x() + transform_origin.x(), |
| 99 position.y() + source_offset.y() + transform_origin.y(), | 99 position.y() + source_offset.y() + transform_origin.y(), |
| 100 transform_origin.z()); | 100 transform_origin.z()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { | 103 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { |
| 104 value->SetInteger("id", id); | 104 value->SetInteger("id", id); |
| 105 value->SetInteger("parent_id", parent_id); | 105 value->SetInteger("parent_id", parent_id); |
| 106 value->SetInteger("owner_id", owner_id); | 106 value->SetInteger("owning_layer_id", owning_layer_id); |
| 107 MathUtil::AddToTracedValue("pre_local", pre_local, value); | 107 MathUtil::AddToTracedValue("pre_local", pre_local, value); |
| 108 MathUtil::AddToTracedValue("local", local, value); | 108 MathUtil::AddToTracedValue("local", local, value); |
| 109 MathUtil::AddToTracedValue("post_local", post_local, value); | 109 MathUtil::AddToTracedValue("post_local", post_local, value); |
| 110 // TODO(sunxd): make frameviewer work without target_id | 110 // TODO(sunxd): make frameviewer work without target_id |
| 111 value->SetInteger("target_id", 0); | 111 value->SetInteger("target_id", 0); |
| 112 value->SetInteger("content_target_id", 0); | 112 value->SetInteger("content_target_id", 0); |
| 113 value->SetInteger("source_node_id", source_node_id); | 113 value->SetInteger("source_node_id", source_node_id); |
| 114 value->SetInteger("sorting_context_id", sorting_context_id); | 114 value->SetInteger("sorting_context_id", sorting_context_id); |
| 115 MathUtil::AddToTracedValue("scroll_offset", scroll_offset, value); | 115 MathUtil::AddToTracedValue("scroll_offset", scroll_offset, value); |
| 116 MathUtil::AddToTracedValue("snap_amount", snap_amount, value); | 116 MathUtil::AddToTracedValue("snap_amount", snap_amount, value); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TransformCachedNodeData::TransformCachedNodeData() | 119 TransformCachedNodeData::TransformCachedNodeData() |
| 120 : target_id(-1), content_target_id(-1), is_showing_backface(false) {} | 120 : target_id(-1), content_target_id(-1), is_showing_backface(false) {} |
| 121 | 121 |
| 122 TransformCachedNodeData::TransformCachedNodeData( | 122 TransformCachedNodeData::TransformCachedNodeData( |
| 123 const TransformCachedNodeData& other) = default; | 123 const TransformCachedNodeData& other) = default; |
| 124 | 124 |
| 125 TransformCachedNodeData::~TransformCachedNodeData() {} | 125 TransformCachedNodeData::~TransformCachedNodeData() {} |
| 126 | 126 |
| 127 bool TransformCachedNodeData::operator==( | 127 bool TransformCachedNodeData::operator==( |
| 128 const TransformCachedNodeData& other) const { | 128 const TransformCachedNodeData& other) const { |
| 129 return from_screen == other.from_screen && to_screen == other.to_screen && | 129 return from_screen == other.from_screen && to_screen == other.to_screen && |
| 130 target_id == other.target_id && | 130 target_id == other.target_id && |
| 131 content_target_id == other.content_target_id && | 131 content_target_id == other.content_target_id && |
| 132 is_showing_backface == other.is_showing_backface; | 132 is_showing_backface == other.is_showing_backface; |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace cc | 135 } // namespace cc |
| OLD | NEW |