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

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
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 4a52bf3a8669ca402f82b2951f055c9537baa63f..4f7c8efbfeb9fcc6b5ac6d492e4872e682a6c9a0 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -467,8 +467,22 @@ void Layer::SetOpacity(float opacity) {
DCHECK(IsPropertyChangeAllowed());
if (opacity_ == opacity)
return;
+ bool force_rebuild = opacity == 1.f || opacity_ == 1.f;
ajuma 2016/05/16 22:05:20 Please add a comment explaining why we need to unc
jaydasika 2016/05/17 01:40:00 Done.
opacity_ = opacity;
SetSubtreePropertyChanged();
ajuma 2016/05/16 22:05:20 I think this is only needed if we rebuild (Layer::
jaydasika 2016/05/17 01:40:00 I think we will need to mark both on the layer and
+ 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_common_unittest.cc » ('j') | cc/trees/layer_tree_host_common_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698