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

Unified Diff: cc/trees/property_tree.cc

Issue 1884613005: cc : Simplify layer skipping logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree.cc
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc
index 54f4ec47496a50ce1f32c6c0ef4d220859a6c18c..2383c57d7ade5dc67ba7d76d0adf7d437bfcb319 100644
--- a/cc/trees/property_tree.cc
+++ b/cc/trees/property_tree.cc
@@ -454,7 +454,8 @@ EffectNodeData::EffectNodeData()
to_screen_opacity_is_animated(false),
hidden_by_backface_visibility(false),
double_sided(false),
- is_drawn(true),
+ is_drawn_on_active(true),
+ is_drawn_on_main_and_pending(true),
has_animated_opacity(false),
effect_changed(false),
num_copy_requests_in_subtree(0),
@@ -474,7 +475,9 @@ bool EffectNodeData::operator==(const EffectNodeData& other) const {
other.node_or_ancestor_has_background_filters &&
to_screen_opacity_is_animated == other.to_screen_opacity_is_animated &&
hidden_by_backface_visibility == other.hidden_by_backface_visibility &&
- double_sided == other.double_sided && is_drawn == other.is_drawn &&
+ double_sided == other.double_sided &&
+ is_drawn_on_active == other.is_drawn_on_active &&
+ is_drawn_on_main_and_pending == other.is_drawn_on_main_and_pending &&
has_animated_opacity == other.has_animated_opacity &&
effect_changed == other.effect_changed &&
num_copy_requests_in_subtree == other.num_copy_requests_in_subtree &&
@@ -495,7 +498,8 @@ void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const {
data->set_to_screen_opacity_is_animated(to_screen_opacity_is_animated);
data->set_hidden_by_backface_visibility(hidden_by_backface_visibility);
data->set_double_sided(double_sided);
- data->set_is_drawn(is_drawn);
+ data->set_is_drawn_on_active(is_drawn_on_active);
+ data->set_is_drawn_on_main_and_pending(is_drawn_on_main_and_pending);
data->set_has_animated_opacity(has_animated_opacity);
data->set_effect_changed(effect_changed);
data->set_num_copy_requests_in_subtree(num_copy_requests_in_subtree);
@@ -518,7 +522,8 @@ void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) {
to_screen_opacity_is_animated = data.to_screen_opacity_is_animated();
hidden_by_backface_visibility = data.hidden_by_backface_visibility();
double_sided = data.double_sided();
- is_drawn = data.is_drawn();
+ is_drawn_on_active = data.is_drawn_on_active();
+ is_drawn_on_main_and_pending = data.is_drawn_on_main_and_pending();
has_animated_opacity = data.has_animated_opacity();
effect_changed = data.effect_changed();
num_copy_requests_in_subtree = data.num_copy_requests_in_subtree();
@@ -1244,17 +1249,25 @@ void EffectTree::UpdateIsDrawn(EffectNode* node, EffectNode* parent_node) {
// 1) Nodes that contribute to copy requests, whether hidden or not, must be
// drawn.
// 2) Nodes that have a background filter.
- // 3) Nodes with animating screen space opacity are drawn if their parent is
- // drawn irrespective of their opacity.
- if (node->data.has_copy_request)
- node->data.is_drawn = true;
- else if (node->data.opacity == 0.f && !node->data.has_animated_opacity &&
- !node->data.has_background_filters)
- node->data.is_drawn = false;
- else if (parent_node)
- node->data.is_drawn = parent_node->data.is_drawn;
- else
- node->data.is_drawn = true;
+ // 3) Nodes with animating screen space opacity on main thread or pending tree
+ // are drawn if their parent is drawn irrespective of their opacity.
+ if (node->data.has_copy_request) {
+ node->data.is_drawn_on_active = true;
+ node->data.is_drawn_on_main_and_pending = true;
+ } else if (!node->data.opacity && !node->data.has_animated_opacity &&
+ !node->data.has_background_filters) {
+ node->data.is_drawn_on_active = false;
+ node->data.is_drawn_on_main_and_pending = false;
+ } else if (parent_node) {
+ node->data.is_drawn_on_active =
+ parent_node->data.is_drawn_on_active &&
+ (node->data.opacity || node->data.has_background_filters);
+ node->data.is_drawn_on_main_and_pending =
+ parent_node->data.is_drawn_on_main_and_pending;
+ } else {
+ node->data.is_drawn_on_active = true;
+ node->data.is_drawn_on_main_and_pending = true;
+ }
}
void EffectTree::UpdateEffectChanged(EffectNode* node,
@@ -1328,12 +1341,20 @@ bool EffectTree::ContributesToDrawnSurface(int id) {
// copy requests.
EffectNode* node = Node(id);
EffectNode* parent_node = parent(node);
+ bool is_active = property_trees()->is_active;
+ bool is_drawn = is_active ? node->data.is_drawn_on_active
+ : node->data.is_drawn_on_main_and_pending;
bool contributes_to_drawn_surface =
- node->data.is_drawn &&
- (node->data.opacity != 0.f || node->data.has_animated_opacity ||
- node->data.has_background_filters);
- if (parent_node && !parent_node->data.is_drawn)
- contributes_to_drawn_surface = false;
+ is_drawn && (node->data.opacity || node->data.has_background_filters ||
+ (!is_active && node->data.has_animated_opacity));
+
+ if (parent_node) {
+ bool parent_is_drawn = is_active
+ ? parent_node->data.is_drawn_on_active
+ : parent_node->data.is_drawn_on_main_and_pending;
+ if (!parent_is_drawn)
+ contributes_to_drawn_surface = false;
+ }
return contributes_to_drawn_surface;
}
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/property_tree.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698