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 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 // If neither this layer nor any of its children were added, early out. | 2358 // If neither this layer nor any of its children were added, early out. |
2359 if (sorting_start_index == descendants.size()) { | 2359 if (sorting_start_index == descendants.size()) { |
2360 DCHECK(!layer->render_surface() || IsRootLayer(layer)); | 2360 DCHECK(!layer->render_surface() || IsRootLayer(layer)); |
2361 return; | 2361 return; |
2362 } | 2362 } |
2363 | 2363 |
2364 // If preserves-3d then sort all the descendants in 3D so that they can be | 2364 // If preserves-3d then sort all the descendants in 3D so that they can be |
2365 // drawn from back to front. If the preserves-3d property is also set on the | 2365 // drawn from back to front. If the preserves-3d property is also set on the |
2366 // parent then skip the sorting as the parent will sort all the descendants | 2366 // parent then skip the sorting as the parent will sort all the descendants |
2367 // anyway. | 2367 // anyway. |
2368 if (globals.layer_sorter && descendants.size() && layer->is_3d_sorted() && | 2368 if (globals.layer_sorter && descendants.size() && layer->Is3dSorted() && |
2369 !LayerIsInExisting3DRenderingContext(layer)) { | 2369 !LayerIsInExisting3DRenderingContext(layer)) { |
2370 SortLayers(descendants.begin() + sorting_start_index, | 2370 SortLayers(descendants.begin() + sorting_start_index, |
2371 descendants.end(), | 2371 descendants.end(), |
2372 globals.layer_sorter); | 2372 globals.layer_sorter); |
2373 } | 2373 } |
2374 | 2374 |
2375 UpdateAccumulatedSurfaceState<LayerType>( | 2375 UpdateAccumulatedSurfaceState<LayerType>( |
2376 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state); | 2376 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state); |
2377 | 2377 |
2378 if (layer->HasContributingDelegatedRenderPasses()) { | 2378 if (layer->HasContributingDelegatedRenderPasses()) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 inputs->current_render_surface_layer_list_id); | 2485 inputs->current_render_surface_layer_list_id); |
2486 | 2486 |
2487 // The dummy layer list should not have been used. | 2487 // The dummy layer list should not have been used. |
2488 DCHECK_EQ(0u, dummy_layer_list.size()); | 2488 DCHECK_EQ(0u, dummy_layer_list.size()); |
2489 // A root layer render_surface should always exist after | 2489 // A root layer render_surface should always exist after |
2490 // CalculateDrawProperties. | 2490 // CalculateDrawProperties. |
2491 DCHECK(inputs->root_layer->render_surface()); | 2491 DCHECK(inputs->root_layer->render_surface()); |
2492 } | 2492 } |
2493 | 2493 |
2494 } // namespace cc | 2494 } // namespace cc |
OLD | NEW |