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> |