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

Unified Diff: cc/layers/layer_impl.cc

Issue 1588093004: Compute if a layer is drawn without LayerTree hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « cc/layers/layer_impl.h ('k') | cc/proto/property_tree.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 422de5cc3d270e16615018432b7f4c674c84ff41..80aa1ca3244a85418643962c6f60ce803191c48f 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -98,8 +98,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
visited_(false),
layer_or_descendant_is_drawn_(false),
layer_or_descendant_has_input_handler_(false),
- sorted_for_recursion_(false),
- is_hidden_from_property_trees_(false) {
+ sorted_for_recursion_(false) {
DCHECK_GT(layer_id_, 0);
DCHECK(layer_tree_impl_);
layer_tree_impl_->RegisterLayer(this);
@@ -653,7 +652,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetClipTreeIndex(clip_tree_index_);
layer->SetEffectTreeIndex(effect_tree_index_);
layer->set_offset_to_transform_parent(offset_to_transform_parent_);
- layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_);
LayerImpl* scroll_parent = nullptr;
if (scroll_parent_) {
@@ -956,7 +954,7 @@ void LayerImpl::UpdatePropertyTreeOpacity() {
// started, but might have finished since then on the compositor thread.
if (node->owner_id != id())
return;
- node->data.opacity = opacity_;
+ node->data.opacity = EffectiveOpacity();
effect_tree.set_needs_update(true);
}
}
@@ -985,7 +983,10 @@ void LayerImpl::OnFilterAnimated(const FilterOperations& filters) {
void LayerImpl::OnOpacityAnimated(float opacity) {
SetOpacity(opacity);
- UpdatePropertyTreeOpacity();
+ // When hide_layer_and_subtree is true, the effective opacity is zero and we
+ // need not update the opacity on property trees.
+ if (!hide_layer_and_subtree_)
+ UpdatePropertyTreeOpacity();
}
void LayerImpl::OnTransformAnimated(const gfx::Transform& transform) {
@@ -1242,6 +1243,10 @@ void LayerImpl::SetOpacity(float opacity) {
NoteLayerPropertyChangedForSubtree();
}
+float LayerImpl::EffectiveOpacity() const {
+ return hide_layer_and_subtree_ ? 0.f : opacity_;
+}
+
bool LayerImpl::OpacityIsAnimating() const {
LayerAnimationController::ObserverType observer_type =
IsActive() ? LayerAnimationController::ObserverType::ACTIVE
@@ -1917,11 +1922,13 @@ gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const {
gfx::Rect(scaled_bounds));
}
-bool LayerImpl::LayerIsHidden() const {
+bool LayerImpl::IsHidden() const {
if (layer_tree_impl()->settings().use_property_trees) {
- return is_hidden_from_property_trees_;
+ EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree;
+ EffectNode* node = effect_tree.Node(effect_tree_index_);
+ return node->data.screen_space_opacity == 0.f;
} else {
- return hide_layer_and_subtree_ || (parent() && parent()->LayerIsHidden());
+ return EffectiveOpacity() == 0.f || (parent() && parent()->IsHidden());
}
}
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/proto/property_tree.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698