summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_common.cc
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2016-01-23 17:20:40 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-24 01:21:50 +0000
commite53c5270ccb49967bc08e5819a5753713ee3fdc7 (patch)
treeffd8b534057b6d618837337d51ddbfacd0741be6 /cc/trees/layer_tree_host_common.cc
parentab34d708e66ae2b9d32d3536a48de5501e34e98c (diff)
downloadchromium_src-e53c5270ccb49967bc08e5819a5753713ee3fdc7.zip
chromium_src-e53c5270ccb49967bc08e5819a5753713ee3fdc7.tar.gz
chromium_src-e53c5270ccb49967bc08e5819a5753713ee3fdc7.tar.bz2
Revert of Compute if a layer is drawn without LayerTree hierarchy (patchset #14 id:250001 of https://codereview.chromium.org/1588093004/ )
Reason for revert: Speculative; might have broken tests on Chrome OS, see http://crbug.com/580806 Original issue's description: > This CL : > * deletes is_hidden > * computes if a layer is drawn using the effect tree > > BUG=575413 > CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel > > Committed: https://crrev.com/5bd215b33e6343d8ae7e52fb822dd552bf8b59a7 > Cr-Commit-Position: refs/heads/master@{#371063} TBR=weiliangc@chromium.org,ajuma@chromium.org,enne@chromium.org,vollick@chromium.org,jaydasika@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=575413 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1621013002 Cr-Commit-Position: refs/heads/master@{#371160}
Diffstat (limited to 'cc/trees/layer_tree_host_common.cc')
-rw-r--r--cc/trees/layer_tree_host_common.cc60
1 files changed, 20 insertions, 40 deletions
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 1414918..76c91a0 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -668,7 +668,7 @@ static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
// The opacity of a layer always applies to its children (either implicitly
// via a render surface or explicitly if the parent preserves 3D), so the
// entire subtree can be skipped if this layer is fully transparent.
- return !layer->EffectiveOpacity();
+ return !layer->opacity();
}
static inline void SavePaintPropertiesLayer(LayerImpl* layer) {}
@@ -1515,7 +1515,7 @@ static void CalculateDrawPropertiesInternal(
// the right results.
const bool layer_is_visible =
data_from_ancestor.subtree_is_visible_from_ancestor &&
- layer->EffectiveOpacity() != 0;
+ !layer->hide_layer_and_subtree();
const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest();
// The root layer cannot skip CalcDrawProperties.
@@ -2327,21 +2327,11 @@ enum PropertyTreeOption {
};
void CalculateRenderTargetInternal(LayerImpl* layer,
- PropertyTrees* property_trees,
bool subtree_visible_from_ancestor,
- bool can_render_to_separate_surface,
- bool use_property_trees) {
- bool layer_is_drawn;
- if (use_property_trees) {
- DCHECK_GE(layer->effect_tree_index(), 0);
- layer_is_drawn =
- property_trees->effect_tree.Node(layer->effect_tree_index())
- ->data.is_drawn;
- } else {
- layer_is_drawn =
- (subtree_visible_from_ancestor && layer->EffectiveOpacity() != 0) ||
- layer->HasCopyRequest();
- }
+ bool can_render_to_separate_surface) {
+ const bool layer_is_visible =
+ subtree_visible_from_ancestor && !layer->hide_layer_and_subtree();
+ const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest();
// The root layer cannot be skipped.
if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_drawn)) {
@@ -2374,8 +2364,7 @@ void CalculateRenderTargetInternal(LayerImpl* layer,
for (size_t i = 0; i < layer->children().size(); ++i) {
CalculateRenderTargetInternal(
LayerTreeHostCommon::get_layer_as_raw_ptr(layer->children(), i),
- property_trees, layer_is_drawn, can_render_to_separate_surface,
- use_property_trees);
+ layer_is_drawn, can_render_to_separate_surface);
}
}
@@ -2406,17 +2395,14 @@ void CalculateRenderSurfaceLayerListInternal(
// |can_render_to_separate_surface| and |current_render_surface_layer_list_id|
// are settings that should stay the same during recursion.
- bool layer_is_drawn = false;
- if (use_property_trees) {
- DCHECK_GE(layer->effect_tree_index(), 0);
- layer_is_drawn =
- property_trees->effect_tree.Node(layer->effect_tree_index())
- ->data.is_drawn;
- } else {
- layer_is_drawn =
- (subtree_visible_from_ancestor && layer->EffectiveOpacity() != 0) ||
- layer->HasCopyRequest();
- }
+
+ // Layers that are marked as hidden will hide themselves and their subtree.
+ // Exception: Layers with copy requests, whether hidden or not, must be drawn
+ // anyway. In this case, we will inform their subtree they are visible to get
+ // the right results.
+ const bool layer_is_visible =
+ subtree_visible_from_ancestor && !layer->hide_layer_and_subtree();
+ const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest();
// The root layer cannot be skipped.
if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_drawn)) {
@@ -2465,14 +2451,10 @@ void CalculateRenderSurfaceLayerListInternal(
// target.
layer->render_surface()->set_contributes_to_drawn_surface(false);
} else {
- bool contributes_to_drawn_surface =
- use_property_trees
- ? property_trees->effect_tree.ContributesToDrawnSurface(
- layer->effect_tree_index())
- : subtree_visible_from_ancestor &&
- layer->EffectiveOpacity() != 0.f;
+ // Even if the |layer_is_drawn|, it only contributes to a drawn surface
+ // when the |layer_is_visible|.
layer->render_surface()->set_contributes_to_drawn_surface(
- contributes_to_drawn_surface);
+ layer_is_visible);
}
// Ignore occlusion from outside the surface when surface contents need to
@@ -2637,10 +2619,8 @@ void CalculateRenderSurfaceLayerListInternal(
void CalculateRenderTarget(
LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) {
- CalculateRenderTargetInternal(
- inputs->root_layer, inputs->property_trees, true,
- inputs->can_render_to_separate_surface,
- inputs->verify_property_trees || inputs->use_property_trees);
+ CalculateRenderTargetInternal(inputs->root_layer, true,
+ inputs->can_render_to_separate_surface);
}
void CalculateRenderSurfaceLayerList(