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

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

Issue 1811423002: SubtreeShouldBeSkipped uses information from property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comments Created 4 years, 8 months 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
« no previous file with comments | « cc/trees/property_tree.h ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 data.layers_are_clipped_when_surfaces_disabled(); 431 data.layers_are_clipped_when_surfaces_disabled();
432 resets_clip = data.resets_clip(); 432 resets_clip = data.resets_clip();
433 } 433 }
434 434
435 EffectNodeData::EffectNodeData() 435 EffectNodeData::EffectNodeData()
436 : opacity(1.f), 436 : opacity(1.f),
437 screen_space_opacity(1.f), 437 screen_space_opacity(1.f),
438 has_render_surface(false), 438 has_render_surface(false),
439 has_copy_request(false), 439 has_copy_request(false),
440 has_background_filters(false), 440 has_background_filters(false),
441 node_or_ancestor_has_background_filters(false),
442 to_screen_opacity_is_animated(false),
443 node_or_ancestor_has_backface_visible_surface(false),
441 is_drawn(true), 444 is_drawn(true),
442 has_animated_opacity(false), 445 has_animated_opacity(false),
443 effect_changed(false), 446 effect_changed(false),
444 num_copy_requests_in_subtree(0), 447 num_copy_requests_in_subtree(0),
445 transform_id(0), 448 transform_id(0),
446 clip_id(0) {} 449 clip_id(0) {}
447 450
448 EffectNodeData::EffectNodeData(const EffectNodeData& other) = default; 451 EffectNodeData::EffectNodeData(const EffectNodeData& other) = default;
449 452
450 bool EffectNodeData::operator==(const EffectNodeData& other) const { 453 bool EffectNodeData::operator==(const EffectNodeData& other) const {
451 return opacity == other.opacity && 454 return opacity == other.opacity &&
452 screen_space_opacity == other.screen_space_opacity && 455 screen_space_opacity == other.screen_space_opacity &&
453 has_render_surface == other.has_render_surface && 456 has_render_surface == other.has_render_surface &&
454 has_copy_request == other.has_copy_request && 457 has_copy_request == other.has_copy_request &&
455 has_background_filters == other.has_background_filters && 458 has_background_filters == other.has_background_filters &&
459 node_or_ancestor_has_background_filters ==
460 other.node_or_ancestor_has_background_filters &&
461 to_screen_opacity_is_animated == other.to_screen_opacity_is_animated &&
462 node_or_ancestor_has_backface_visible_surface ==
463 other.node_or_ancestor_has_backface_visible_surface &&
456 is_drawn == other.is_drawn && 464 is_drawn == other.is_drawn &&
457 has_animated_opacity == other.has_animated_opacity && 465 has_animated_opacity == other.has_animated_opacity &&
458 effect_changed == other.effect_changed && 466 effect_changed == other.effect_changed &&
459 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && 467 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree &&
460 transform_id == other.transform_id && clip_id == other.clip_id; 468 transform_id == other.transform_id && clip_id == other.clip_id;
461 } 469 }
462 470
463 void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const { 471 void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const {
464 DCHECK(!proto->has_effect_node_data()); 472 DCHECK(!proto->has_effect_node_data());
465 proto::EffectNodeData* data = proto->mutable_effect_node_data(); 473 proto::EffectNodeData* data = proto->mutable_effect_node_data();
466 data->set_opacity(opacity); 474 data->set_opacity(opacity);
467 data->set_screen_space_opacity(screen_space_opacity); 475 data->set_screen_space_opacity(screen_space_opacity);
468 data->set_has_render_surface(has_render_surface); 476 data->set_has_render_surface(has_render_surface);
469 data->set_has_copy_request(has_copy_request); 477 data->set_has_copy_request(has_copy_request);
470 data->set_has_background_filters(has_background_filters); 478 data->set_has_background_filters(has_background_filters);
479 data->set_node_or_ancestor_has_background_filters(
480 node_or_ancestor_has_background_filters);
481 data->set_to_screen_opacity_is_animated(to_screen_opacity_is_animated);
482 data->set_node_or_ancestor_has_backface_visible_surface(
483 node_or_ancestor_has_backface_visible_surface);
471 data->set_is_drawn(is_drawn); 484 data->set_is_drawn(is_drawn);
472 data->set_has_animated_opacity(has_animated_opacity); 485 data->set_has_animated_opacity(has_animated_opacity);
473 data->set_effect_changed(effect_changed); 486 data->set_effect_changed(effect_changed);
474 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); 487 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree);
475 data->set_transform_id(transform_id); 488 data->set_transform_id(transform_id);
476 data->set_clip_id(clip_id); 489 data->set_clip_id(clip_id);
477 } 490 }
478 491
479 void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) { 492 void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) {
480 DCHECK(proto.has_effect_node_data()); 493 DCHECK(proto.has_effect_node_data());
481 const proto::EffectNodeData& data = proto.effect_node_data(); 494 const proto::EffectNodeData& data = proto.effect_node_data();
482 495
483 opacity = data.opacity(); 496 opacity = data.opacity();
484 screen_space_opacity = data.screen_space_opacity(); 497 screen_space_opacity = data.screen_space_opacity();
485 has_render_surface = data.has_render_surface(); 498 has_render_surface = data.has_render_surface();
486 has_copy_request = data.has_copy_request(); 499 has_copy_request = data.has_copy_request();
487 has_background_filters = data.has_background_filters(); 500 has_background_filters = data.has_background_filters();
501 node_or_ancestor_has_background_filters =
502 data.node_or_ancestor_has_background_filters();
503 to_screen_opacity_is_animated = data.to_screen_opacity_is_animated();
504 node_or_ancestor_has_backface_visible_surface =
505 data.node_or_ancestor_has_backface_visible_surface();
488 is_drawn = data.is_drawn(); 506 is_drawn = data.is_drawn();
489 has_animated_opacity = data.has_animated_opacity(); 507 has_animated_opacity = data.has_animated_opacity();
490 effect_changed = data.effect_changed(); 508 effect_changed = data.effect_changed();
491 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); 509 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree();
492 transform_id = data.transform_id(); 510 transform_id = data.transform_id();
493 clip_id = data.clip_id(); 511 clip_id = data.clip_id();
494 } 512 }
495 513
496 ScrollNodeData::ScrollNodeData() 514 ScrollNodeData::ScrollNodeData()
497 : scrollable(false), 515 : scrollable(false),
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 node->data.is_drawn = true; 1216 node->data.is_drawn = true;
1199 } 1217 }
1200 1218
1201 void EffectTree::UpdateEffectChanged(EffectNode* node, 1219 void EffectTree::UpdateEffectChanged(EffectNode* node,
1202 EffectNode* parent_node) { 1220 EffectNode* parent_node) {
1203 if (parent_node && parent_node->data.effect_changed) { 1221 if (parent_node && parent_node->data.effect_changed) {
1204 node->data.effect_changed = true; 1222 node->data.effect_changed = true;
1205 } 1223 }
1206 } 1224 }
1207 1225
1226 void EffectTree::UpdateBackfaceVisibility(EffectNode* node,
1227 EffectNode* parent_node) {
1228 if (node->owner_id == -1) {
jaydasika 2016/03/29 15:48:43 Are there any cases where the owner id will be -1
sunxd 2016/03/30 15:21:34 The only case is the dummy tree root. Another opti
ajuma 2016/03/30 17:10:11 How about just checking if parent_node is null?
1229 node->data.node_or_ancestor_has_backface_visible_surface = false;
1230 return;
1231 }
1232 if (parent_node &&
1233 parent_node->data.node_or_ancestor_has_backface_visible_surface) {
1234 node->data.node_or_ancestor_has_backface_visible_surface = true;
ajuma 2016/03/29 17:06:46 I think this early-out is only valid if we're taki
sunxd 2016/03/30 15:21:34 Done.
1235 return;
1236 }
1237
1238 TransformTree& transform_tree = property_trees()->transform_tree;
1239 TransformNode* transform_node = transform_tree.Node(node->data.transform_id);
ajuma 2016/03/29 17:06:46 Is this the right transform id? I think this is th
sunxd 2016/03/30 15:21:34 I think it is the correct one. In AddEffectNodeIfN
1240 if (node->data.has_render_surface) {
1241 if (transform_node->data.is_invertible &&
1242 transform_node->data.ancestors_are_invertible) {
1243 if (transform_node->data.sorting_context_id) {
1244 const TransformNode* parent_transform_node =
1245 transform_tree.parent(transform_node);
1246 if (parent_transform_node &&
1247 parent_transform_node->data.sorting_context_id ==
1248 transform_node->data.sorting_context_id) {
1249 gfx::Transform surface_draw_transform;
1250 transform_tree.ComputeTransform(transform_node->id,
1251 transform_node->data.target_id,
1252 &surface_draw_transform);
1253 node->data.node_or_ancestor_has_backface_visible_surface =
1254 surface_draw_transform.IsBackFaceVisible();
1255 } else {
1256 node->data.node_or_ancestor_has_backface_visible_surface =
1257 transform_node->data.local.IsBackFaceVisible();
1258 }
1259 return;
1260 }
1261 }
1262 }
1263 node->data.node_or_ancestor_has_backface_visible_surface = false;
1264 }
1265
1208 void EffectTree::UpdateEffects(int id) { 1266 void EffectTree::UpdateEffects(int id) {
1209 EffectNode* node = Node(id); 1267 EffectNode* node = Node(id);
1210 EffectNode* parent_node = parent(node); 1268 EffectNode* parent_node = parent(node);
1211 1269
1212 UpdateOpacities(node, parent_node); 1270 UpdateOpacities(node, parent_node);
1213 UpdateIsDrawn(node, parent_node); 1271 UpdateIsDrawn(node, parent_node);
1214 UpdateEffectChanged(node, parent_node); 1272 UpdateEffectChanged(node, parent_node);
1273 UpdateBackfaceVisibility(node, parent_node);
1215 } 1274 }
1216 1275
1217 void EffectTree::ClearCopyRequests() { 1276 void EffectTree::ClearCopyRequests() {
1218 for (auto& node : nodes()) { 1277 for (auto& node : nodes()) {
1219 node.data.num_copy_requests_in_subtree = 0; 1278 node.data.num_copy_requests_in_subtree = 0;
1220 node.data.has_copy_request = false; 1279 node.data.has_copy_request = false;
1221 } 1280 }
1222 set_needs_update(true); 1281 set_needs_update(true);
1223 } 1282 }
1224 1283
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 break; 1909 break;
1851 case ALL_TREES: 1910 case ALL_TREES:
1852 transform_tree.ResetChangeTracking(); 1911 transform_tree.ResetChangeTracking();
1853 effect_tree.ResetChangeTracking(); 1912 effect_tree.ResetChangeTracking();
1854 } 1913 }
1855 changed = false; 1914 changed = false;
1856 full_tree_damaged = false; 1915 full_tree_damaged = false;
1857 } 1916 }
1858 1917
1859 } // namespace cc 1918 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree.h ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698