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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 1624693004: cc:: Add transform nodes at boundaries of 3d rendering contexts (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
Index: cc/trees/draw_property_utils.cc
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index fa522368a32906f731ec11a2e986cfad063a7587..da73fa374026e355f9c5b5ce98acd764b34a6da9 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -204,20 +204,6 @@ void CalculateVisibleRects(const std::vector<LayerType*>& visible_layer_list,
}
template <typename LayerType>
-static bool IsRootLayerOfNewRenderingContext(LayerType* layer) {
- if (layer->parent())
- return !layer->parent()->Is3dSorted() && layer->Is3dSorted();
- return layer->Is3dSorted();
-}
-
-template <typename LayerType>
-static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
- return layer->Is3dSorted() && layer->parent() &&
- layer->parent()->Is3dSorted() &&
- layer->parent()->sorting_context_id() == layer->sorting_context_id();
-}
-
-template <typename LayerType>
static bool TransformToScreenIsKnown(LayerType* layer,
const TransformTree& tree) {
const TransformNode* node = tree.Node(layer->transform_tree_index());
@@ -242,7 +228,9 @@ static bool IsLayerBackFaceVisible(LayerType* layer,
// rendering context" or not. For Chromium code, we can determine whether we
// are in a 3d rendering context by checking if the parent preserves 3d.
- if (LayerIsInExisting3DRenderingContext(layer))
+ const TransformNode* node = tree.Node(layer->transform_tree_index());
+ const TransformNode* parent_node = tree.parent(node);
+ if (node->data.is_3d_sorted && parent_node && parent_node->data.is_3d_sorted)
ajuma 2016/01/25 14:35:22 Is this equivalent to the existing logic? Say we h
weiliangc 2016/01/25 21:29:26 Would it make sense for A, B/C, and M to create 3
ajuma 2016/01/25 21:53:00 That makes sense (if adding 3 nodes isn't too expe
jaydasika 2016/01/26 00:10:01 I think we can do with just 2 nodes. A and M will
return DrawTransformFromPropertyTrees(layer, tree).IsBackFaceVisible();
// In this case, either the layer establishes a new 3d rendering context, or
@@ -255,8 +243,15 @@ static bool IsSurfaceBackFaceVisible(LayerType* layer,
const TransformTree& tree) {
if (HasSingularTransform(layer, tree))
return false;
- if (LayerIsInExisting3DRenderingContext(layer)) {
- const TransformNode* node = tree.Node(layer->transform_tree_index());
+ const TransformNode* node = tree.Node(layer->transform_tree_index());
+ // If the render_surface is not part of a new or existing rendering context,
+ // then the layers that contribute to this surface will decide back-face
+ // visibility for themselves.
+ if (!node->data.is_3d_sorted)
+ return false;
+
+ const TransformNode* parent_node = tree.parent(node);
+ if (parent_node && parent_node->data.is_3d_sorted) {
// Draw transform as a contributing render surface.
// TODO(enne): we shouldn't walk the tree during a tree walk.
gfx::Transform surface_draw_transform;
@@ -265,13 +260,9 @@ static bool IsSurfaceBackFaceVisible(LayerType* layer,
return surface_draw_transform.IsBackFaceVisible();
}
- if (IsRootLayerOfNewRenderingContext(layer))
- return layer->transform().IsBackFaceVisible();
-
- // If the render_surface is not part of a new or existing rendering context,
- // then the layers that contribute to this surface will decide back-face
- // visibility for themselves.
- return false;
+ // We use layer's transform to determine back face visibility when its the
+ // root of a new rendering context.
+ return layer->transform().IsBackFaceVisible();
ajuma 2016/01/25 14:35:22 If we reach here, it it necessarily the case that
jaydasika 2016/01/27 20:52:37 We always have a transform node for surfaces. So w
ajuma 2016/01/28 00:08:35 Oh, right, I missed that this layer owns a surface
}
template <typename LayerType>
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/property_tree.h » ('j') | cc/trees/property_tree.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698