Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: cc/trees/transform_node.cc

Issue 2448403002: cc: Clean up transform tree (Closed)
Patch Set: PAC Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/proto/property_tree.pb.h" 8 #include "cc/proto/property_tree.pb.h"
9 #include "cc/trees/transform_node.h" 9 #include "cc/trees/transform_node.h"
10 #include "ui/gfx/geometry/point3_f.h" 10 #include "ui/gfx/geometry/point3_f.h"
(...skipping 12 matching lines...) Expand all
23 is_invertible(true), 23 is_invertible(true),
24 ancestors_are_invertible(true), 24 ancestors_are_invertible(true),
25 has_potential_animation(false), 25 has_potential_animation(false),
26 is_currently_animating(false), 26 is_currently_animating(false),
27 to_screen_is_potentially_animated(false), 27 to_screen_is_potentially_animated(false),
28 has_only_translation_animations(true), 28 has_only_translation_animations(true),
29 flattens_inherited_transform(false), 29 flattens_inherited_transform(false),
30 node_and_ancestors_are_flat(true), 30 node_and_ancestors_are_flat(true),
31 node_and_ancestors_have_only_integer_translation(true), 31 node_and_ancestors_have_only_integer_translation(true),
32 scrolls(false), 32 scrolls(false),
33 needs_surface_contents_scale(false),
34 affected_by_inner_viewport_bounds_delta_x(false), 33 affected_by_inner_viewport_bounds_delta_x(false),
35 affected_by_inner_viewport_bounds_delta_y(false), 34 affected_by_inner_viewport_bounds_delta_y(false),
36 affected_by_outer_viewport_bounds_delta_x(false), 35 affected_by_outer_viewport_bounds_delta_x(false),
37 affected_by_outer_viewport_bounds_delta_y(false), 36 affected_by_outer_viewport_bounds_delta_y(false),
38 in_subtree_of_page_scale_layer(false), 37 in_subtree_of_page_scale_layer(false),
39 transform_changed(false), 38 transform_changed(false),
40 post_local_scale_factor(1.0f) {} 39 post_local_scale_factor(1.0f) {}
41 40
42 TransformNode::TransformNode(const TransformNode&) = default; 41 TransformNode::TransformNode(const TransformNode&) = default;
43 42
(...skipping 13 matching lines...) Expand all
57 is_currently_animating == other.is_currently_animating && 56 is_currently_animating == other.is_currently_animating &&
58 to_screen_is_potentially_animated == 57 to_screen_is_potentially_animated ==
59 other.to_screen_is_potentially_animated && 58 other.to_screen_is_potentially_animated &&
60 has_only_translation_animations == 59 has_only_translation_animations ==
61 other.has_only_translation_animations && 60 other.has_only_translation_animations &&
62 flattens_inherited_transform == other.flattens_inherited_transform && 61 flattens_inherited_transform == other.flattens_inherited_transform &&
63 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat && 62 node_and_ancestors_are_flat == other.node_and_ancestors_are_flat &&
64 node_and_ancestors_have_only_integer_translation == 63 node_and_ancestors_have_only_integer_translation ==
65 other.node_and_ancestors_have_only_integer_translation && 64 other.node_and_ancestors_have_only_integer_translation &&
66 scrolls == other.scrolls && 65 scrolls == other.scrolls &&
67 needs_surface_contents_scale == other.needs_surface_contents_scale &&
68 affected_by_inner_viewport_bounds_delta_x == 66 affected_by_inner_viewport_bounds_delta_x ==
69 other.affected_by_inner_viewport_bounds_delta_x && 67 other.affected_by_inner_viewport_bounds_delta_x &&
70 affected_by_inner_viewport_bounds_delta_y == 68 affected_by_inner_viewport_bounds_delta_y ==
71 other.affected_by_inner_viewport_bounds_delta_y && 69 other.affected_by_inner_viewport_bounds_delta_y &&
72 affected_by_outer_viewport_bounds_delta_x == 70 affected_by_outer_viewport_bounds_delta_x ==
73 other.affected_by_outer_viewport_bounds_delta_x && 71 other.affected_by_outer_viewport_bounds_delta_x &&
74 affected_by_outer_viewport_bounds_delta_y == 72 affected_by_outer_viewport_bounds_delta_y ==
75 other.affected_by_outer_viewport_bounds_delta_y && 73 other.affected_by_outer_viewport_bounds_delta_y &&
76 in_subtree_of_page_scale_layer == 74 in_subtree_of_page_scale_layer ==
77 other.in_subtree_of_page_scale_layer && 75 other.in_subtree_of_page_scale_layer &&
78 transform_changed == other.transform_changed && 76 transform_changed == other.transform_changed &&
79 post_local_scale_factor == other.post_local_scale_factor && 77 post_local_scale_factor == other.post_local_scale_factor &&
80 surface_contents_scale == other.surface_contents_scale &&
81 scroll_offset == other.scroll_offset && 78 scroll_offset == other.scroll_offset &&
82 scroll_snap == other.scroll_snap && 79 scroll_snap == other.scroll_snap &&
83 source_offset == other.source_offset && 80 source_offset == other.source_offset &&
84 source_to_parent == other.source_to_parent; 81 source_to_parent == other.source_to_parent;
85 } 82 }
86 83
87 void TransformNode::update_pre_local_transform( 84 void TransformNode::update_pre_local_transform(
88 const gfx::Point3F& transform_origin) { 85 const gfx::Point3F& transform_origin) {
89 pre_local.MakeIdentity(); 86 pre_local.MakeIdentity();
90 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(), 87 pre_local.Translate3d(-transform_origin.x(), -transform_origin.y(),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 data->set_to_screen_is_potentially_animated( 129 data->set_to_screen_is_potentially_animated(
133 to_screen_is_potentially_animated); 130 to_screen_is_potentially_animated);
134 data->set_has_only_translation_animations(has_only_translation_animations); 131 data->set_has_only_translation_animations(has_only_translation_animations);
135 132
136 data->set_flattens_inherited_transform(flattens_inherited_transform); 133 data->set_flattens_inherited_transform(flattens_inherited_transform);
137 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat); 134 data->set_node_and_ancestors_are_flat(node_and_ancestors_are_flat);
138 135
139 data->set_node_and_ancestors_have_only_integer_translation( 136 data->set_node_and_ancestors_have_only_integer_translation(
140 node_and_ancestors_have_only_integer_translation); 137 node_and_ancestors_have_only_integer_translation);
141 data->set_scrolls(scrolls); 138 data->set_scrolls(scrolls);
142 data->set_needs_surface_contents_scale(needs_surface_contents_scale);
143 139
144 data->set_affected_by_inner_viewport_bounds_delta_x( 140 data->set_affected_by_inner_viewport_bounds_delta_x(
145 affected_by_inner_viewport_bounds_delta_x); 141 affected_by_inner_viewport_bounds_delta_x);
146 data->set_affected_by_inner_viewport_bounds_delta_y( 142 data->set_affected_by_inner_viewport_bounds_delta_y(
147 affected_by_inner_viewport_bounds_delta_y); 143 affected_by_inner_viewport_bounds_delta_y);
148 data->set_affected_by_outer_viewport_bounds_delta_x( 144 data->set_affected_by_outer_viewport_bounds_delta_x(
149 affected_by_outer_viewport_bounds_delta_x); 145 affected_by_outer_viewport_bounds_delta_x);
150 data->set_affected_by_outer_viewport_bounds_delta_y( 146 data->set_affected_by_outer_viewport_bounds_delta_y(
151 affected_by_outer_viewport_bounds_delta_y); 147 affected_by_outer_viewport_bounds_delta_y);
152 148
153 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer); 149 data->set_in_subtree_of_page_scale_layer(in_subtree_of_page_scale_layer);
154 data->set_transform_changed(transform_changed); 150 data->set_transform_changed(transform_changed);
155 data->set_post_local_scale_factor(post_local_scale_factor); 151 data->set_post_local_scale_factor(post_local_scale_factor);
156 152
157 Vector2dFToProto(surface_contents_scale,
158 data->mutable_surface_contents_scale());
159 ScrollOffsetToProto(scroll_offset, data->mutable_scroll_offset()); 153 ScrollOffsetToProto(scroll_offset, data->mutable_scroll_offset());
160 Vector2dFToProto(scroll_snap, data->mutable_scroll_snap()); 154 Vector2dFToProto(scroll_snap, data->mutable_scroll_snap());
161 Vector2dFToProto(source_offset, data->mutable_source_offset()); 155 Vector2dFToProto(source_offset, data->mutable_source_offset());
162 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent()); 156 Vector2dFToProto(source_to_parent, data->mutable_source_to_parent());
163 } 157 }
164 158
165 void TransformNode::FromProtobuf(const proto::TreeNode& proto) { 159 void TransformNode::FromProtobuf(const proto::TreeNode& proto) {
166 id = proto.id(); 160 id = proto.id();
167 parent_id = proto.parent_id(); 161 parent_id = proto.parent_id();
168 owner_id = proto.owner_id(); 162 owner_id = proto.owner_id();
(...skipping 22 matching lines...) Expand all
191 is_currently_animating = data.is_currently_animating(); 185 is_currently_animating = data.is_currently_animating();
192 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated(); 186 to_screen_is_potentially_animated = data.to_screen_is_potentially_animated();
193 has_only_translation_animations = data.has_only_translation_animations(); 187 has_only_translation_animations = data.has_only_translation_animations();
194 188
195 flattens_inherited_transform = data.flattens_inherited_transform(); 189 flattens_inherited_transform = data.flattens_inherited_transform();
196 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat(); 190 node_and_ancestors_are_flat = data.node_and_ancestors_are_flat();
197 191
198 node_and_ancestors_have_only_integer_translation = 192 node_and_ancestors_have_only_integer_translation =
199 data.node_and_ancestors_have_only_integer_translation(); 193 data.node_and_ancestors_have_only_integer_translation();
200 scrolls = data.scrolls(); 194 scrolls = data.scrolls();
201 needs_surface_contents_scale = data.needs_surface_contents_scale();
202 195
203 affected_by_inner_viewport_bounds_delta_x = 196 affected_by_inner_viewport_bounds_delta_x =
204 data.affected_by_inner_viewport_bounds_delta_x(); 197 data.affected_by_inner_viewport_bounds_delta_x();
205 affected_by_inner_viewport_bounds_delta_y = 198 affected_by_inner_viewport_bounds_delta_y =
206 data.affected_by_inner_viewport_bounds_delta_y(); 199 data.affected_by_inner_viewport_bounds_delta_y();
207 affected_by_outer_viewport_bounds_delta_x = 200 affected_by_outer_viewport_bounds_delta_x =
208 data.affected_by_outer_viewport_bounds_delta_x(); 201 data.affected_by_outer_viewport_bounds_delta_x();
209 affected_by_outer_viewport_bounds_delta_y = 202 affected_by_outer_viewport_bounds_delta_y =
210 data.affected_by_outer_viewport_bounds_delta_y(); 203 data.affected_by_outer_viewport_bounds_delta_y();
211 204
212 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer(); 205 in_subtree_of_page_scale_layer = data.in_subtree_of_page_scale_layer();
213 transform_changed = data.transform_changed(); 206 transform_changed = data.transform_changed();
214 post_local_scale_factor = data.post_local_scale_factor(); 207 post_local_scale_factor = data.post_local_scale_factor();
215 208
216 surface_contents_scale = ProtoToVector2dF(data.surface_contents_scale());
217 scroll_offset = ProtoToScrollOffset(data.scroll_offset()); 209 scroll_offset = ProtoToScrollOffset(data.scroll_offset());
218 scroll_snap = ProtoToVector2dF(data.scroll_snap()); 210 scroll_snap = ProtoToVector2dF(data.scroll_snap());
219 source_offset = ProtoToVector2dF(data.source_offset()); 211 source_offset = ProtoToVector2dF(data.source_offset());
220 source_to_parent = ProtoToVector2dF(data.source_to_parent()); 212 source_to_parent = ProtoToVector2dF(data.source_to_parent());
221 } 213 }
222 214
223 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const { 215 void TransformNode::AsValueInto(base::trace_event::TracedValue* value) const {
224 value->SetInteger("id", id); 216 value->SetInteger("id", id);
225 value->SetInteger("parent_id", parent_id); 217 value->SetInteger("parent_id", parent_id);
226 value->SetInteger("owner_id", owner_id); 218 value->SetInteger("owner_id", owner_id);
(...skipping 12 matching lines...) Expand all
239 TransformCachedNodeData::TransformCachedNodeData() 231 TransformCachedNodeData::TransformCachedNodeData()
240 : target_id(-1), content_target_id(-1) {} 232 : target_id(-1), content_target_id(-1) {}
241 233
242 TransformCachedNodeData::TransformCachedNodeData( 234 TransformCachedNodeData::TransformCachedNodeData(
243 const TransformCachedNodeData& other) = default; 235 const TransformCachedNodeData& other) = default;
244 236
245 TransformCachedNodeData::~TransformCachedNodeData() {} 237 TransformCachedNodeData::~TransformCachedNodeData() {}
246 238
247 bool TransformCachedNodeData::operator==( 239 bool TransformCachedNodeData::operator==(
248 const TransformCachedNodeData& other) const { 240 const TransformCachedNodeData& other) const {
249 return from_target == other.from_target && to_target == other.to_target && 241 return from_screen == other.from_screen && to_screen == other.to_screen &&
250 from_screen == other.from_screen && to_screen == other.to_screen &&
251 target_id == other.target_id && 242 target_id == other.target_id &&
252 content_target_id == other.content_target_id; 243 content_target_id == other.content_target_id;
253 } 244 }
254 245
255 void TransformCachedNodeData::ToProtobuf( 246 void TransformCachedNodeData::ToProtobuf(
256 proto::TransformCachedNodeData* proto) const { 247 proto::TransformCachedNodeData* proto) const {
257 TransformToProto(from_target, proto->mutable_from_target());
258 TransformToProto(to_target, proto->mutable_to_target());
259 TransformToProto(from_screen, proto->mutable_from_screen()); 248 TransformToProto(from_screen, proto->mutable_from_screen());
260 TransformToProto(to_screen, proto->mutable_to_screen()); 249 TransformToProto(to_screen, proto->mutable_to_screen());
261 proto->set_target_id(target_id); 250 proto->set_target_id(target_id);
262 proto->set_content_target_id(content_target_id); 251 proto->set_content_target_id(content_target_id);
263 } 252 }
264 253
265 void TransformCachedNodeData::FromProtobuf( 254 void TransformCachedNodeData::FromProtobuf(
266 const proto::TransformCachedNodeData& proto) { 255 const proto::TransformCachedNodeData& proto) {
267 from_target = ProtoToTransform(proto.from_target());
268 to_target = ProtoToTransform(proto.to_target());
269 from_screen = ProtoToTransform(proto.from_screen()); 256 from_screen = ProtoToTransform(proto.from_screen());
270 to_screen = ProtoToTransform(proto.to_screen()); 257 to_screen = ProtoToTransform(proto.to_screen());
271 target_id = proto.target_id(); 258 target_id = proto.target_id();
272 content_target_id = proto.content_target_id(); 259 content_target_id = proto.content_target_id();
273 } 260 }
274 261
275 } // namespace cc 262 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/transform_node.h ('k') | third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698