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

Unified Diff: cc/layers/layer.cc

Issue 1979413002: cc : Rebuild property trees when opacity changes only if its required. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host.cc » ('j') | cc/trees/layer_tree_host.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 4a52bf3a8669ca402f82b2951f055c9537baa63f..eb851d86b972a2226cdc3e1817fa7080495894fe 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -467,8 +467,24 @@ void Layer::SetOpacity(float opacity) {
DCHECK(IsPropertyChangeAllowed());
if (opacity_ == opacity)
return;
+ // We need to force a property tree rebuild when opacity changes from 1 to a
+ // non-1 value or vice-versa as render surfaces can change.
+ bool force_rebuild = opacity == 1.f || opacity_ == 1.f;
opacity_ = opacity;
SetSubtreePropertyChanged();
+ if (layer_tree_host_ && !force_rebuild) {
+ PropertyTrees* property_trees = layer_tree_host_->property_trees();
+ auto effect_id_to_index = property_trees->effect_id_to_index_map.find(id());
+ if (effect_id_to_index != property_trees->effect_id_to_index_map.end()) {
+ EffectNode* node =
+ property_trees->effect_tree.Node(effect_id_to_index->second);
+ node->data.opacity = opacity;
+ node->data.effect_changed = true;
+ property_trees->effect_tree.set_needs_update(true);
+ SetNeedsCommitNoRebuild();
+ return;
+ }
+ }
SetNeedsCommit();
}
« no previous file with comments | « no previous file | cc/trees/layer_tree_host.cc » ('j') | cc/trees/layer_tree_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698