| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 : opacity(1.f), | 493 : opacity(1.f), |
| 494 screen_space_opacity(1.f), | 494 screen_space_opacity(1.f), |
| 495 has_render_surface(false), | 495 has_render_surface(false), |
| 496 render_surface(nullptr), | 496 render_surface(nullptr), |
| 497 has_copy_request(false), | 497 has_copy_request(false), |
| 498 has_background_filters(false), | 498 has_background_filters(false), |
| 499 hidden_by_backface_visibility(false), | 499 hidden_by_backface_visibility(false), |
| 500 double_sided(false), | 500 double_sided(false), |
| 501 is_drawn(true), | 501 is_drawn(true), |
| 502 subtree_hidden(false), | 502 subtree_hidden(false), |
| 503 has_animated_opacity(false), | 503 has_potential_opacity_animation(false), |
| 504 is_currently_animating_opacity(false), |
| 504 effect_changed(false), | 505 effect_changed(false), |
| 505 num_copy_requests_in_subtree(0), | 506 num_copy_requests_in_subtree(0), |
| 506 transform_id(0), | 507 transform_id(0), |
| 507 clip_id(0), | 508 clip_id(0), |
| 508 target_id(0) {} | 509 target_id(0) {} |
| 509 | 510 |
| 510 EffectNodeData::EffectNodeData(const EffectNodeData& other) = default; | 511 EffectNodeData::EffectNodeData(const EffectNodeData& other) = default; |
| 511 | 512 |
| 512 bool EffectNodeData::operator==(const EffectNodeData& other) const { | 513 bool EffectNodeData::operator==(const EffectNodeData& other) const { |
| 513 return opacity == other.opacity && | 514 return opacity == other.opacity && |
| 514 screen_space_opacity == other.screen_space_opacity && | 515 screen_space_opacity == other.screen_space_opacity && |
| 515 has_render_surface == other.has_render_surface && | 516 has_render_surface == other.has_render_surface && |
| 516 has_copy_request == other.has_copy_request && | 517 has_copy_request == other.has_copy_request && |
| 517 has_background_filters == other.has_background_filters && | 518 has_background_filters == other.has_background_filters && |
| 518 hidden_by_backface_visibility == other.hidden_by_backface_visibility && | 519 hidden_by_backface_visibility == other.hidden_by_backface_visibility && |
| 519 double_sided == other.double_sided && is_drawn == other.is_drawn && | 520 double_sided == other.double_sided && is_drawn == other.is_drawn && |
| 520 subtree_hidden == other.subtree_hidden && | 521 subtree_hidden == other.subtree_hidden && |
| 521 has_animated_opacity == other.has_animated_opacity && | 522 has_potential_opacity_animation == |
| 523 other.has_potential_opacity_animation && |
| 524 is_currently_animating_opacity == |
| 525 other.is_currently_animating_opacity && |
| 522 effect_changed == other.effect_changed && | 526 effect_changed == other.effect_changed && |
| 523 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && | 527 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && |
| 524 transform_id == other.transform_id && clip_id == other.clip_id && | 528 transform_id == other.transform_id && clip_id == other.clip_id && |
| 525 target_id == other.target_id; | 529 target_id == other.target_id; |
| 526 } | 530 } |
| 527 | 531 |
| 528 void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const { | 532 void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const { |
| 529 DCHECK(!proto->has_effect_node_data()); | 533 DCHECK(!proto->has_effect_node_data()); |
| 530 proto::EffectNodeData* data = proto->mutable_effect_node_data(); | 534 proto::EffectNodeData* data = proto->mutable_effect_node_data(); |
| 531 data->set_opacity(opacity); | 535 data->set_opacity(opacity); |
| 532 data->set_screen_space_opacity(screen_space_opacity); | 536 data->set_screen_space_opacity(screen_space_opacity); |
| 533 data->set_has_render_surface(has_render_surface); | 537 data->set_has_render_surface(has_render_surface); |
| 534 data->set_has_copy_request(has_copy_request); | 538 data->set_has_copy_request(has_copy_request); |
| 535 data->set_has_background_filters(has_background_filters); | 539 data->set_has_background_filters(has_background_filters); |
| 536 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); | 540 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); |
| 537 data->set_double_sided(double_sided); | 541 data->set_double_sided(double_sided); |
| 538 data->set_is_drawn(is_drawn); | 542 data->set_is_drawn(is_drawn); |
| 539 data->set_subtree_hidden(subtree_hidden); | 543 data->set_subtree_hidden(subtree_hidden); |
| 540 data->set_has_animated_opacity(has_animated_opacity); | 544 data->set_has_potential_opacity_animation(has_potential_opacity_animation); |
| 545 data->set_is_currently_animating_opacity(is_currently_animating_opacity); |
| 541 data->set_effect_changed(effect_changed); | 546 data->set_effect_changed(effect_changed); |
| 542 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); | 547 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); |
| 543 data->set_transform_id(transform_id); | 548 data->set_transform_id(transform_id); |
| 544 data->set_clip_id(clip_id); | 549 data->set_clip_id(clip_id); |
| 545 data->set_target_id(target_id); | 550 data->set_target_id(target_id); |
| 546 } | 551 } |
| 547 | 552 |
| 548 void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) { | 553 void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) { |
| 549 DCHECK(proto.has_effect_node_data()); | 554 DCHECK(proto.has_effect_node_data()); |
| 550 const proto::EffectNodeData& data = proto.effect_node_data(); | 555 const proto::EffectNodeData& data = proto.effect_node_data(); |
| 551 | 556 |
| 552 opacity = data.opacity(); | 557 opacity = data.opacity(); |
| 553 screen_space_opacity = data.screen_space_opacity(); | 558 screen_space_opacity = data.screen_space_opacity(); |
| 554 has_render_surface = data.has_render_surface(); | 559 has_render_surface = data.has_render_surface(); |
| 555 has_copy_request = data.has_copy_request(); | 560 has_copy_request = data.has_copy_request(); |
| 556 has_background_filters = data.has_background_filters(); | 561 has_background_filters = data.has_background_filters(); |
| 557 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); | 562 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); |
| 558 double_sided = data.double_sided(); | 563 double_sided = data.double_sided(); |
| 559 is_drawn = data.is_drawn(); | 564 is_drawn = data.is_drawn(); |
| 560 subtree_hidden = data.subtree_hidden(); | 565 subtree_hidden = data.subtree_hidden(); |
| 561 has_animated_opacity = data.has_animated_opacity(); | 566 has_potential_opacity_animation = data.has_potential_opacity_animation(); |
| 567 is_currently_animating_opacity = data.is_currently_animating_opacity(); |
| 562 effect_changed = data.effect_changed(); | 568 effect_changed = data.effect_changed(); |
| 563 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); | 569 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); |
| 564 transform_id = data.transform_id(); | 570 transform_id = data.transform_id(); |
| 565 clip_id = data.clip_id(); | 571 clip_id = data.clip_id(); |
| 566 target_id = data.target_id(); | 572 target_id = data.target_id(); |
| 567 } | 573 } |
| 568 | 574 |
| 569 void EffectNodeData::AsValueInto(base::trace_event::TracedValue* value) const { | 575 void EffectNodeData::AsValueInto(base::trace_event::TracedValue* value) const { |
| 570 value->SetDouble("opacity", opacity); | 576 value->SetDouble("opacity", opacity); |
| 571 value->SetBoolean("has_render_surface", has_render_surface); | 577 value->SetBoolean("has_render_surface", has_render_surface); |
| 572 value->SetBoolean("has_copy_request", has_copy_request); | 578 value->SetBoolean("has_copy_request", has_copy_request); |
| 573 value->SetBoolean("has_background_filters", has_background_filters); | 579 value->SetBoolean("has_background_filters", has_background_filters); |
| 574 value->SetBoolean("double_sided", double_sided); | 580 value->SetBoolean("double_sided", double_sided); |
| 575 value->SetBoolean("is_drawn", is_drawn); | 581 value->SetBoolean("is_drawn", is_drawn); |
| 576 value->SetBoolean("has_animated_opacity", has_animated_opacity); | 582 value->SetBoolean("has_potential_opacity_animation", |
| 583 has_potential_opacity_animation); |
| 577 value->SetBoolean("effect_changed", effect_changed); | 584 value->SetBoolean("effect_changed", effect_changed); |
| 578 value->SetInteger("num_copy_requests_in_subtree", | 585 value->SetInteger("num_copy_requests_in_subtree", |
| 579 num_copy_requests_in_subtree); | 586 num_copy_requests_in_subtree); |
| 580 value->SetInteger("transform_id", transform_id); | 587 value->SetInteger("transform_id", transform_id); |
| 581 value->SetInteger("clip_id", clip_id); | 588 value->SetInteger("clip_id", clip_id); |
| 582 value->SetInteger("target_id", target_id); | 589 value->SetInteger("target_id", target_id); |
| 583 } | 590 } |
| 584 | 591 |
| 585 ScrollNodeData::ScrollNodeData() | 592 ScrollNodeData::ScrollNodeData() |
| 586 : scrollable(false), | 593 : scrollable(false), |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 // Nodes that have screen space opacity 0 are hidden. So they are not drawn. | 1323 // Nodes that have screen space opacity 0 are hidden. So they are not drawn. |
| 1317 // Exceptions: | 1324 // Exceptions: |
| 1318 // 1) Nodes that contribute to copy requests, whether hidden or not, must be | 1325 // 1) Nodes that contribute to copy requests, whether hidden or not, must be |
| 1319 // drawn. | 1326 // drawn. |
| 1320 // 2) Nodes that have a background filter. | 1327 // 2) Nodes that have a background filter. |
| 1321 // 3) Nodes with animating screen space opacity on main thread or pending tree | 1328 // 3) Nodes with animating screen space opacity on main thread or pending tree |
| 1322 // are drawn if their parent is drawn irrespective of their opacity. | 1329 // are drawn if their parent is drawn irrespective of their opacity. |
| 1323 if (node->data.has_copy_request) | 1330 if (node->data.has_copy_request) |
| 1324 node->data.is_drawn = true; | 1331 node->data.is_drawn = true; |
| 1325 else if (EffectiveOpacity(node) == 0.f && | 1332 else if (EffectiveOpacity(node) == 0.f && |
| 1326 (!node->data.has_animated_opacity || property_trees()->is_active) && | 1333 (!node->data.has_potential_opacity_animation || |
| 1334 property_trees()->is_active) && |
| 1327 !node->data.has_background_filters) | 1335 !node->data.has_background_filters) |
| 1328 node->data.is_drawn = false; | 1336 node->data.is_drawn = false; |
| 1329 else if (parent_node) | 1337 else if (parent_node) |
| 1330 node->data.is_drawn = parent_node->data.is_drawn; | 1338 node->data.is_drawn = parent_node->data.is_drawn; |
| 1331 else | 1339 else |
| 1332 node->data.is_drawn = true; | 1340 node->data.is_drawn = true; |
| 1333 } | 1341 } |
| 1334 | 1342 |
| 1335 void EffectTree::UpdateEffectChanged(EffectNode* node, | 1343 void EffectTree::UpdateEffectChanged(EffectNode* node, |
| 1336 EffectNode* parent_node) { | 1344 EffectNode* parent_node) { |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2068 value->EndDictionary(); | 2076 value->EndDictionary(); |
| 2069 | 2077 |
| 2070 value->BeginDictionary("scroll_tree"); | 2078 value->BeginDictionary("scroll_tree"); |
| 2071 scroll_tree.AsValueInto(value.get()); | 2079 scroll_tree.AsValueInto(value.get()); |
| 2072 value->EndDictionary(); | 2080 value->EndDictionary(); |
| 2073 | 2081 |
| 2074 return value; | 2082 return value; |
| 2075 } | 2083 } |
| 2076 | 2084 |
| 2077 } // namespace cc | 2085 } // namespace cc |
| OLD | NEW |