OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // state vector is empty, both of which should be impossible. | 320 // state vector is empty, both of which should be impossible. |
321 DCHECK(found_render_target); | 321 DCHECK(found_render_target); |
322 } | 322 } |
323 | 323 |
324 template <typename LayerType> static inline bool IsRootLayer(LayerType* layer) { | 324 template <typename LayerType> static inline bool IsRootLayer(LayerType* layer) { |
325 return !layer->parent(); | 325 return !layer->parent(); |
326 } | 326 } |
327 | 327 |
328 template <typename LayerType> | 328 template <typename LayerType> |
329 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { | 329 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { |
330 return layer->is_3d_sorted() && layer->parent() && | 330 return layer->Is3dSorted() && layer->parent() && |
331 layer->parent()->is_3d_sorted(); | 331 layer->parent()->Is3dSorted(); |
332 } | 332 } |
333 | 333 |
334 template <typename LayerType> | 334 template <typename LayerType> |
335 static bool IsRootLayerOfNewRenderingContext(LayerType* layer) { | 335 static bool IsRootLayerOfNewRenderingContext(LayerType* layer) { |
336 if (layer->parent()) | 336 if (layer->parent()) |
337 return !layer->parent()->is_3d_sorted() && layer->is_3d_sorted(); | 337 return !layer->parent()->Is3dSorted() && layer->Is3dSorted(); |
338 | 338 |
339 return layer->is_3d_sorted(); | 339 return layer->Is3dSorted(); |
340 } | 340 } |
341 | 341 |
342 template <typename LayerType> | 342 template <typename LayerType> |
343 static bool IsLayerBackFaceVisible(LayerType* layer) { | 343 static bool IsLayerBackFaceVisible(LayerType* layer) { |
344 // The current W3C spec on CSS transforms says that backface visibility should | 344 // The current W3C spec on CSS transforms says that backface visibility should |
345 // be determined differently depending on whether the layer is in a "3d | 345 // be determined differently depending on whether the layer is in a "3d |
346 // rendering context" or not. For Chromium code, we can determine whether we | 346 // rendering context" or not. For Chromium code, we can determine whether we |
347 // are in a 3d rendering context by checking if the parent preserves 3d. | 347 // are in a 3d rendering context by checking if the parent preserves 3d. |
348 | 348 |
349 if (LayerIsInExisting3DRenderingContext(layer)) | 349 if (LayerIsInExisting3DRenderingContext(layer)) |
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2280 // If neither this layer nor any of its children were added, early out. | 2280 // If neither this layer nor any of its children were added, early out. |
2281 if (sorting_start_index == descendants.size()) { | 2281 if (sorting_start_index == descendants.size()) { |
2282 DCHECK(!layer->render_surface() || IsRootLayer(layer)); | 2282 DCHECK(!layer->render_surface() || IsRootLayer(layer)); |
2283 return; | 2283 return; |
2284 } | 2284 } |
2285 | 2285 |
2286 // If preserves-3d then sort all the descendants in 3D so that they can be | 2286 // If preserves-3d then sort all the descendants in 3D so that they can be |
2287 // drawn from back to front. If the preserves-3d property is also set on the | 2287 // drawn from back to front. If the preserves-3d property is also set on the |
2288 // parent then skip the sorting as the parent will sort all the descendants | 2288 // parent then skip the sorting as the parent will sort all the descendants |
2289 // anyway. | 2289 // anyway. |
2290 if (globals.layer_sorter && descendants.size() && layer->is_3d_sorted() && | 2290 if (globals.layer_sorter && descendants.size() && layer->Is3dSorted() && |
2291 !LayerIsInExisting3DRenderingContext(layer)) { | 2291 !LayerIsInExisting3DRenderingContext(layer)) { |
2292 SortLayers(descendants.begin() + sorting_start_index, | 2292 SortLayers(descendants.begin() + sorting_start_index, |
2293 descendants.end(), | 2293 descendants.end(), |
2294 globals.layer_sorter); | 2294 globals.layer_sorter); |
2295 } | 2295 } |
2296 | 2296 |
2297 UpdateAccumulatedSurfaceState<LayerType>( | 2297 UpdateAccumulatedSurfaceState<LayerType>( |
2298 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state); | 2298 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state); |
2299 | 2299 |
2300 if (layer->HasContributingDelegatedRenderPasses()) { | 2300 if (layer->HasContributingDelegatedRenderPasses()) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 inputs->current_render_surface_layer_list_id); | 2407 inputs->current_render_surface_layer_list_id); |
2408 | 2408 |
2409 // The dummy layer list should not have been used. | 2409 // The dummy layer list should not have been used. |
2410 DCHECK_EQ(0u, dummy_layer_list.size()); | 2410 DCHECK_EQ(0u, dummy_layer_list.size()); |
2411 // A root layer render_surface should always exist after | 2411 // A root layer render_surface should always exist after |
2412 // CalculateDrawProperties. | 2412 // CalculateDrawProperties. |
2413 DCHECK(inputs->root_layer->render_surface()); | 2413 DCHECK(inputs->root_layer->render_surface()); |
2414 } | 2414 } |
2415 | 2415 |
2416 } // namespace cc | 2416 } // namespace cc |
OLD | NEW |