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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 1047463002: Determine face orientation in (x, y: w) projected space (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | ui/gfx/transform.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index aa115f722648acc87a848bae40f36ff35eee9116..2fbbdc05dc846530b2167e9bfb99dfb22dcd49f5 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -327,41 +327,32 @@ static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
}
template <typename LayerType>
-static bool IsRootLayerOfNewRenderingContext(LayerType* layer) {
- if (layer->parent())
- return !layer->parent()->Is3dSorted() && layer->Is3dSorted();
-
- return layer->Is3dSorted();
-}
-
-template <typename LayerType>
static bool IsLayerBackFaceVisible(LayerType* layer) {
// The current W3C spec on CSS transforms says that backface visibility should
// be determined differently depending on whether the layer is in a "3d
- // 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))
+ // rendering context" or not.
+
+ // TODO(trchen): We should use the accumulated transform between the layer
+ // and the flattening layer (i.e. the parent of the root of the 3D-rendering
+ // context) to determine face orientation. Using draw transform works here
+ // because we make 3D-transformed flattening layer always creating a surface.
+ // Such requirement is not really necessary.
+ if (layer->Is3dSorted())
return layer->draw_transform().IsBackFaceVisible();
- // In this case, either the layer establishes a new 3d rendering context, or
- // is not in a 3d rendering context at all.
+ // TODO(trchen): This is not entirely correct because the paint effect should
+ // include the perspective transform from parent element, which is provided
+ // in a separate layer.
return layer->transform().IsBackFaceVisible();
}
template <typename LayerType>
static bool IsSurfaceBackFaceVisible(LayerType* layer,
const gfx::Transform& draw_transform) {
- if (LayerIsInExisting3DRenderingContext(layer))
+ if (layer->Is3dSorted())
return 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;
+ return layer->transform().IsBackFaceVisible();
}
template <typename LayerType>
« no previous file with comments | « no previous file | ui/gfx/transform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698