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/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2497 std::vector<AccumulatedSurfaceState<Layer>> accumulated_surface_state; | 2497 std::vector<AccumulatedSurfaceState<Layer>> accumulated_surface_state; |
2498 CalculateDrawPropertiesInternal<Layer>( | 2498 CalculateDrawPropertiesInternal<Layer>( |
2499 inputs->root_layer, globals, data_for_recursion, | 2499 inputs->root_layer, globals, data_for_recursion, |
2500 inputs->render_surface_layer_list, &dummy_layer_list, | 2500 inputs->render_surface_layer_list, &dummy_layer_list, |
2501 &accumulated_surface_state, | 2501 &accumulated_surface_state, |
2502 inputs->current_render_surface_layer_list_id); | 2502 inputs->current_render_surface_layer_list_id); |
2503 } | 2503 } |
2504 | 2504 |
2505 // The translation from layer to property trees is an intermediate state. We | 2505 // The translation from layer to property trees is an intermediate state. We |
2506 // will eventually get these data passed directly to the compositor. | 2506 // will eventually get these data passed directly to the compositor. |
2507 TransformTree transform_tree; | |
2508 ClipTree clip_tree; | |
2509 OpacityTree opacity_tree; | |
2510 { | 2507 { |
2511 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), | 2508 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), |
2512 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees"); | 2509 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees"); |
2513 ComputeVisibleRectsUsingPropertyTrees( | 2510 ComputeVisibleRectsUsingPropertyTrees( |
2514 inputs->root_layer, inputs->page_scale_application_layer, | 2511 inputs->root_layer, inputs->page_scale_application_layer, |
2515 inputs->page_scale_factor, inputs->device_scale_factor, | 2512 inputs->page_scale_factor, inputs->device_scale_factor, |
2516 gfx::Rect(inputs->device_viewport_size), inputs->device_transform, | 2513 gfx::Rect(inputs->device_viewport_size), inputs->device_transform, |
2517 &transform_tree, &clip_tree, &opacity_tree); | 2514 inputs->property_trees); |
2518 } | 2515 } |
2519 | 2516 |
2520 LayerIterator<Layer> it, end; | 2517 LayerIterator<Layer> it, end; |
2521 for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list), | 2518 for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list), |
2522 end = LayerIterator<Layer>::End(inputs->render_surface_layer_list); | 2519 end = LayerIterator<Layer>::End(inputs->render_surface_layer_list); |
2523 it != end; ++it) { | 2520 it != end; ++it) { |
2524 Layer* current_layer = *it; | 2521 Layer* current_layer = *it; |
2525 if (!it.represents_itself() || !current_layer->DrawsContent()) | 2522 if (!it.represents_itself() || !current_layer->DrawsContent()) |
2526 continue; | 2523 continue; |
2527 | 2524 |
2528 const bool visible_rects_match = | 2525 const bool visible_rects_match = |
2529 ApproximatelyEqual(current_layer->visible_content_rect(), | 2526 ApproximatelyEqual(current_layer->visible_content_rect(), |
2530 current_layer->visible_rect_from_property_trees()); | 2527 current_layer->visible_rect_from_property_trees()); |
2531 CHECK(visible_rects_match) | 2528 CHECK(visible_rects_match) |
2532 << "expected: " << current_layer->visible_content_rect().ToString() | 2529 << "expected: " << current_layer->visible_content_rect().ToString() |
2533 << " actual: " | 2530 << " actual: " |
2534 << current_layer->visible_rect_from_property_trees().ToString(); | 2531 << current_layer->visible_rect_from_property_trees().ToString(); |
2535 | 2532 |
2536 const bool draw_transforms_match = ApproximatelyEqual( | 2533 const bool draw_transforms_match = |
2537 current_layer->draw_transform(), | 2534 ApproximatelyEqual(current_layer->draw_transform(), |
2538 current_layer->draw_transform_from_property_trees(transform_tree)); | 2535 current_layer->draw_transform_from_property_trees( |
| 2536 inputs->property_trees->transform_tree)); |
2539 CHECK(draw_transforms_match); | 2537 CHECK(draw_transforms_match); |
2540 | 2538 |
2541 const bool draw_opacities_match = | 2539 const bool draw_opacities_match = |
2542 current_layer->draw_opacity() == | 2540 current_layer->draw_opacity() == |
2543 current_layer->DrawOpacityFromPropertyTrees(opacity_tree); | 2541 current_layer->DrawOpacityFromPropertyTrees( |
| 2542 inputs->property_trees->opacity_tree); |
2544 CHECK(draw_opacities_match); | 2543 CHECK(draw_opacities_match); |
2545 } | 2544 } |
2546 } | 2545 } |
2547 | 2546 |
2548 // The dummy layer list should not have been used. | 2547 // The dummy layer list should not have been used. |
2549 DCHECK_EQ(0u, dummy_layer_list.size()); | 2548 DCHECK_EQ(0u, dummy_layer_list.size()); |
2550 // A root layer render_surface should always exist after | 2549 // A root layer render_surface should always exist after |
2551 // CalculateDrawProperties. | 2550 // CalculateDrawProperties. |
2552 DCHECK(inputs->root_layer->render_surface()); | 2551 DCHECK(inputs->root_layer->render_surface()); |
2553 } | 2552 } |
(...skipping 18 matching lines...) Expand all Loading... |
2572 inputs->current_render_surface_layer_list_id); | 2571 inputs->current_render_surface_layer_list_id); |
2573 | 2572 |
2574 // The dummy layer list should not have been used. | 2573 // The dummy layer list should not have been used. |
2575 DCHECK_EQ(0u, dummy_layer_list.size()); | 2574 DCHECK_EQ(0u, dummy_layer_list.size()); |
2576 // A root layer render_surface should always exist after | 2575 // A root layer render_surface should always exist after |
2577 // CalculateDrawProperties. | 2576 // CalculateDrawProperties. |
2578 DCHECK(inputs->root_layer->render_surface()); | 2577 DCHECK(inputs->root_layer->render_surface()); |
2579 } | 2578 } |
2580 | 2579 |
2581 } // namespace cc | 2580 } // namespace cc |
OLD | NEW |