| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 layers_are_clipped_when_surfaces_disabled); | 512 layers_are_clipped_when_surfaces_disabled); |
| 513 value->SetBoolean("resets_clip", resets_clip); | 513 value->SetBoolean("resets_clip", resets_clip); |
| 514 } | 514 } |
| 515 | 515 |
| 516 EffectNodeData::EffectNodeData() | 516 EffectNodeData::EffectNodeData() |
| 517 : opacity(1.f), | 517 : opacity(1.f), |
| 518 screen_space_opacity(1.f), | 518 screen_space_opacity(1.f), |
| 519 has_render_surface(false), | 519 has_render_surface(false), |
| 520 render_surface(nullptr), | 520 render_surface(nullptr), |
| 521 has_copy_request(false), | 521 has_copy_request(false), |
| 522 has_background_filters(false), | |
| 523 hidden_by_backface_visibility(false), | 522 hidden_by_backface_visibility(false), |
| 524 double_sided(false), | 523 double_sided(false), |
| 525 is_drawn(true), | 524 is_drawn(true), |
| 526 subtree_hidden(false), | 525 subtree_hidden(false), |
| 527 has_potential_opacity_animation(false), | 526 has_potential_opacity_animation(false), |
| 528 is_currently_animating_opacity(false), | 527 is_currently_animating_opacity(false), |
| 529 effect_changed(false), | 528 effect_changed(false), |
| 530 num_copy_requests_in_subtree(0), | 529 num_copy_requests_in_subtree(0), |
| 531 has_unclipped_descendants(false), | 530 has_unclipped_descendants(false), |
| 532 transform_id(0), | 531 transform_id(0), |
| 533 clip_id(0), | 532 clip_id(0), |
| 534 target_id(0), | 533 target_id(0), |
| 535 mask_layer_id(-1), | 534 mask_layer_id(-1), |
| 536 replica_layer_id(-1), | 535 replica_layer_id(-1), |
| 537 replica_mask_layer_id(-1) {} | 536 replica_mask_layer_id(-1) {} |
| 538 | 537 |
| 539 EffectNodeData::EffectNodeData(const EffectNodeData& other) = default; | 538 EffectNodeData::EffectNodeData(const EffectNodeData& other) = default; |
| 540 | 539 |
| 541 bool EffectNodeData::operator==(const EffectNodeData& other) const { | 540 bool EffectNodeData::operator==(const EffectNodeData& other) const { |
| 542 return opacity == other.opacity && | 541 return opacity == other.opacity && |
| 543 screen_space_opacity == other.screen_space_opacity && | 542 screen_space_opacity == other.screen_space_opacity && |
| 544 has_render_surface == other.has_render_surface && | 543 has_render_surface == other.has_render_surface && |
| 545 has_copy_request == other.has_copy_request && | 544 has_copy_request == other.has_copy_request && |
| 546 has_background_filters == other.has_background_filters && | 545 background_filters == other.background_filters && |
| 547 hidden_by_backface_visibility == other.hidden_by_backface_visibility && | 546 hidden_by_backface_visibility == other.hidden_by_backface_visibility && |
| 548 double_sided == other.double_sided && is_drawn == other.is_drawn && | 547 double_sided == other.double_sided && is_drawn == other.is_drawn && |
| 549 subtree_hidden == other.subtree_hidden && | 548 subtree_hidden == other.subtree_hidden && |
| 550 has_potential_opacity_animation == | 549 has_potential_opacity_animation == |
| 551 other.has_potential_opacity_animation && | 550 other.has_potential_opacity_animation && |
| 552 is_currently_animating_opacity == | 551 is_currently_animating_opacity == |
| 553 other.is_currently_animating_opacity && | 552 other.is_currently_animating_opacity && |
| 554 effect_changed == other.effect_changed && | 553 effect_changed == other.effect_changed && |
| 555 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && | 554 num_copy_requests_in_subtree == other.num_copy_requests_in_subtree && |
| 556 transform_id == other.transform_id && clip_id == other.clip_id && | 555 transform_id == other.transform_id && clip_id == other.clip_id && |
| 557 target_id == other.target_id && mask_layer_id == other.mask_layer_id && | 556 target_id == other.target_id && mask_layer_id == other.mask_layer_id && |
| 558 replica_layer_id == other.replica_layer_id && | 557 replica_layer_id == other.replica_layer_id && |
| 559 replica_mask_layer_id == other.replica_mask_layer_id; | 558 replica_mask_layer_id == other.replica_mask_layer_id; |
| 560 } | 559 } |
| 561 | 560 |
| 562 void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const { | 561 void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const { |
| 563 DCHECK(!proto->has_effect_node_data()); | 562 DCHECK(!proto->has_effect_node_data()); |
| 564 proto::EffectNodeData* data = proto->mutable_effect_node_data(); | 563 proto::EffectNodeData* data = proto->mutable_effect_node_data(); |
| 565 data->set_opacity(opacity); | 564 data->set_opacity(opacity); |
| 566 data->set_screen_space_opacity(screen_space_opacity); | 565 data->set_screen_space_opacity(screen_space_opacity); |
| 567 data->set_has_render_surface(has_render_surface); | 566 data->set_has_render_surface(has_render_surface); |
| 568 data->set_has_copy_request(has_copy_request); | 567 data->set_has_copy_request(has_copy_request); |
| 569 data->set_has_background_filters(has_background_filters); | |
| 570 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); | 568 data->set_hidden_by_backface_visibility(hidden_by_backface_visibility); |
| 571 data->set_double_sided(double_sided); | 569 data->set_double_sided(double_sided); |
| 572 data->set_is_drawn(is_drawn); | 570 data->set_is_drawn(is_drawn); |
| 573 data->set_subtree_hidden(subtree_hidden); | 571 data->set_subtree_hidden(subtree_hidden); |
| 574 data->set_has_potential_opacity_animation(has_potential_opacity_animation); | 572 data->set_has_potential_opacity_animation(has_potential_opacity_animation); |
| 575 data->set_is_currently_animating_opacity(is_currently_animating_opacity); | 573 data->set_is_currently_animating_opacity(is_currently_animating_opacity); |
| 576 data->set_effect_changed(effect_changed); | 574 data->set_effect_changed(effect_changed); |
| 577 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); | 575 data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree); |
| 578 data->set_transform_id(transform_id); | 576 data->set_transform_id(transform_id); |
| 579 data->set_clip_id(clip_id); | 577 data->set_clip_id(clip_id); |
| 580 data->set_target_id(target_id); | 578 data->set_target_id(target_id); |
| 581 data->set_mask_layer_id(mask_layer_id); | 579 data->set_mask_layer_id(mask_layer_id); |
| 582 data->set_replica_layer_id(replica_layer_id); | 580 data->set_replica_layer_id(replica_layer_id); |
| 583 data->set_replica_mask_layer_id(replica_mask_layer_id); | 581 data->set_replica_mask_layer_id(replica_mask_layer_id); |
| 584 } | 582 } |
| 585 | 583 |
| 586 void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) { | 584 void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) { |
| 587 DCHECK(proto.has_effect_node_data()); | 585 DCHECK(proto.has_effect_node_data()); |
| 588 const proto::EffectNodeData& data = proto.effect_node_data(); | 586 const proto::EffectNodeData& data = proto.effect_node_data(); |
| 589 | 587 |
| 590 opacity = data.opacity(); | 588 opacity = data.opacity(); |
| 591 screen_space_opacity = data.screen_space_opacity(); | 589 screen_space_opacity = data.screen_space_opacity(); |
| 592 has_render_surface = data.has_render_surface(); | 590 has_render_surface = data.has_render_surface(); |
| 593 has_copy_request = data.has_copy_request(); | 591 has_copy_request = data.has_copy_request(); |
| 594 has_background_filters = data.has_background_filters(); | |
| 595 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); | 592 hidden_by_backface_visibility = data.hidden_by_backface_visibility(); |
| 596 double_sided = data.double_sided(); | 593 double_sided = data.double_sided(); |
| 597 is_drawn = data.is_drawn(); | 594 is_drawn = data.is_drawn(); |
| 598 subtree_hidden = data.subtree_hidden(); | 595 subtree_hidden = data.subtree_hidden(); |
| 599 has_potential_opacity_animation = data.has_potential_opacity_animation(); | 596 has_potential_opacity_animation = data.has_potential_opacity_animation(); |
| 600 is_currently_animating_opacity = data.is_currently_animating_opacity(); | 597 is_currently_animating_opacity = data.is_currently_animating_opacity(); |
| 601 effect_changed = data.effect_changed(); | 598 effect_changed = data.effect_changed(); |
| 602 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); | 599 num_copy_requests_in_subtree = data.num_copy_requests_in_subtree(); |
| 603 transform_id = data.transform_id(); | 600 transform_id = data.transform_id(); |
| 604 clip_id = data.clip_id(); | 601 clip_id = data.clip_id(); |
| 605 target_id = data.target_id(); | 602 target_id = data.target_id(); |
| 606 mask_layer_id = data.mask_layer_id(); | 603 mask_layer_id = data.mask_layer_id(); |
| 607 replica_layer_id = data.replica_layer_id(); | 604 replica_layer_id = data.replica_layer_id(); |
| 608 replica_mask_layer_id = data.replica_mask_layer_id(); | 605 replica_mask_layer_id = data.replica_mask_layer_id(); |
| 609 } | 606 } |
| 610 | 607 |
| 611 void EffectNodeData::AsValueInto(base::trace_event::TracedValue* value) const { | 608 void EffectNodeData::AsValueInto(base::trace_event::TracedValue* value) const { |
| 612 value->SetDouble("opacity", opacity); | 609 value->SetDouble("opacity", opacity); |
| 613 value->SetBoolean("has_render_surface", has_render_surface); | 610 value->SetBoolean("has_render_surface", has_render_surface); |
| 614 value->SetBoolean("has_copy_request", has_copy_request); | 611 value->SetBoolean("has_copy_request", has_copy_request); |
| 615 value->SetBoolean("has_background_filters", has_background_filters); | |
| 616 value->SetBoolean("double_sided", double_sided); | 612 value->SetBoolean("double_sided", double_sided); |
| 617 value->SetBoolean("is_drawn", is_drawn); | 613 value->SetBoolean("is_drawn", is_drawn); |
| 618 value->SetBoolean("has_potential_opacity_animation", | 614 value->SetBoolean("has_potential_opacity_animation", |
| 619 has_potential_opacity_animation); | 615 has_potential_opacity_animation); |
| 620 value->SetBoolean("effect_changed", effect_changed); | 616 value->SetBoolean("effect_changed", effect_changed); |
| 621 value->SetInteger("num_copy_requests_in_subtree", | 617 value->SetInteger("num_copy_requests_in_subtree", |
| 622 num_copy_requests_in_subtree); | 618 num_copy_requests_in_subtree); |
| 623 value->SetInteger("transform_id", transform_id); | 619 value->SetInteger("transform_id", transform_id); |
| 624 value->SetInteger("clip_id", clip_id); | 620 value->SetInteger("clip_id", clip_id); |
| 625 value->SetInteger("target_id", target_id); | 621 value->SetInteger("target_id", target_id); |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 // 1) Nodes that contribute to copy requests, whether hidden or not, must be | 1464 // 1) Nodes that contribute to copy requests, whether hidden or not, must be |
| 1469 // drawn. | 1465 // drawn. |
| 1470 // 2) Nodes that have a background filter. | 1466 // 2) Nodes that have a background filter. |
| 1471 // 3) Nodes with animating screen space opacity on main thread or pending tree | 1467 // 3) Nodes with animating screen space opacity on main thread or pending tree |
| 1472 // are drawn if their parent is drawn irrespective of their opacity. | 1468 // are drawn if their parent is drawn irrespective of their opacity. |
| 1473 if (node->data.has_copy_request) | 1469 if (node->data.has_copy_request) |
| 1474 node->data.is_drawn = true; | 1470 node->data.is_drawn = true; |
| 1475 else if (EffectiveOpacity(node) == 0.f && | 1471 else if (EffectiveOpacity(node) == 0.f && |
| 1476 (!node->data.has_potential_opacity_animation || | 1472 (!node->data.has_potential_opacity_animation || |
| 1477 property_trees()->is_active) && | 1473 property_trees()->is_active) && |
| 1478 !node->data.has_background_filters) | 1474 node->data.background_filters.IsEmpty()) |
| 1479 node->data.is_drawn = false; | 1475 node->data.is_drawn = false; |
| 1480 else if (parent_node) | 1476 else if (parent_node) |
| 1481 node->data.is_drawn = parent_node->data.is_drawn; | 1477 node->data.is_drawn = parent_node->data.is_drawn; |
| 1482 else | 1478 else |
| 1483 node->data.is_drawn = true; | 1479 node->data.is_drawn = true; |
| 1484 } | 1480 } |
| 1485 | 1481 |
| 1486 void EffectTree::UpdateEffectChanged(EffectNode* node, | 1482 void EffectTree::UpdateEffectChanged(EffectNode* node, |
| 1487 EffectNode* parent_node) { | 1483 EffectNode* parent_node) { |
| 1488 if (parent_node && parent_node->data.effect_changed) { | 1484 if (parent_node && parent_node->data.effect_changed) { |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 value->EndDictionary(); | 2387 value->EndDictionary(); |
| 2392 | 2388 |
| 2393 value->BeginDictionary("scroll_tree"); | 2389 value->BeginDictionary("scroll_tree"); |
| 2394 scroll_tree.AsValueInto(value.get()); | 2390 scroll_tree.AsValueInto(value.get()); |
| 2395 value->EndDictionary(); | 2391 value->EndDictionary(); |
| 2396 | 2392 |
| 2397 return value; | 2393 return value; |
| 2398 } | 2394 } |
| 2399 | 2395 |
| 2400 } // namespace cc | 2396 } // namespace cc |
| OLD | NEW |