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

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 1811423002: SubtreeShouldBeSkipped uses information from property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return !layer->parent(); 248 return !layer->parent();
249 } 249 }
250 250
251 template <typename LayerType> 251 template <typename LayerType>
252 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { 252 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
253 return layer->Is3dSorted() && layer->parent() && 253 return layer->Is3dSorted() && layer->parent() &&
254 layer->parent()->Is3dSorted() && 254 layer->parent()->Is3dSorted() &&
255 (layer->parent()->sorting_context_id() == layer->sorting_context_id()); 255 (layer->parent()->sorting_context_id() == layer->sorting_context_id());
256 } 256 }
257 257
258 static bool IsRootLayerOfNewRenderingContext(LayerImpl* layer) {
259 if (layer->parent())
260 return !layer->parent()->Is3dSorted() && layer->Is3dSorted();
261
262 return layer->Is3dSorted();
263 }
264
265 static bool IsLayerBackFaceVisible(LayerImpl* layer, 258 static bool IsLayerBackFaceVisible(LayerImpl* layer,
266 const TransformTree& transform_tree) { 259 const TransformTree& transform_tree) {
267 // The current W3C spec on CSS transforms says that backface visibility should 260 // The current W3C spec on CSS transforms says that backface visibility should
268 // be determined differently depending on whether the layer is in a "3d 261 // be determined differently depending on whether the layer is in a "3d
269 // rendering context" or not. For Chromium code, we can determine whether we 262 // rendering context" or not. For Chromium code, we can determine whether we
270 // are in a 3d rendering context by checking if the parent preserves 3d. 263 // are in a 3d rendering context by checking if the parent preserves 3d.
271 264
272 if (LayerIsInExisting3DRenderingContext(layer)) { 265 if (LayerIsInExisting3DRenderingContext(layer)) {
273 return draw_property_utils::DrawTransform(layer, transform_tree) 266 return draw_property_utils::DrawTransform(layer, transform_tree)
274 .IsBackFaceVisible(); 267 .IsBackFaceVisible();
275 } 268 }
276 269
277 // In this case, either the layer establishes a new 3d rendering context, or 270 // In this case, either the layer establishes a new 3d rendering context, or
278 // is not in a 3d rendering context at all. 271 // is not in a 3d rendering context at all.
279 return layer->transform().IsBackFaceVisible(); 272 return layer->transform().IsBackFaceVisible();
280 } 273 }
281 274
282 static bool IsSurfaceBackFaceVisible(LayerImpl* layer, 275 static bool IsSurfaceBackFaceVisible(LayerImpl* layer,
283 const gfx::Transform& draw_transform) { 276 const gfx::Transform& draw_transform) {
284 if (LayerIsInExisting3DRenderingContext(layer)) 277 return layer->layer_tree_impl()
285 return draw_transform.IsBackFaceVisible(); 278 ->property_trees()
286 279 ->effect_tree.Node(layer->effect_tree_index())
287 if (IsRootLayerOfNewRenderingContext(layer)) 280 ->data.node_or_ancestor_has_backface_visible_surface;
288 return layer->transform().IsBackFaceVisible();
289
290 // If the render_surface is not part of a new or existing rendering context,
291 // then the layers that contribute to this surface will decide back-face
292 // visibility for themselves.
293 return false;
294 } 281 }
295 282
296 static bool LayerShouldBeSkipped(LayerImpl* layer, 283 static bool LayerShouldBeSkipped(LayerImpl* layer,
297 bool layer_is_drawn, 284 bool layer_is_drawn,
298 const TransformTree& transform_tree) { 285 const TransformTree& transform_tree) {
299 // Layers can be skipped if any of these conditions are met. 286 // Layers can be skipped if any of these conditions are met.
300 // - is not drawn due to it or one of its ancestors being hidden (or having 287 // - is not drawn due to it or one of its ancestors being hidden (or having
301 // no copy requests). 288 // no copy requests).
302 // - does not draw content. 289 // - does not draw content.
303 // - is transparent. 290 // - is transparent.
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1105
1119 PropertyTrees* GetPropertyTrees(Layer* layer) { 1106 PropertyTrees* GetPropertyTrees(Layer* layer) {
1120 return layer->layer_tree_host()->property_trees(); 1107 return layer->layer_tree_host()->property_trees();
1121 } 1108 }
1122 1109
1123 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 1110 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
1124 return layer->layer_tree_impl()->property_trees(); 1111 return layer->layer_tree_impl()->property_trees();
1125 } 1112 }
1126 1113
1127 } // namespace cc 1114 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698