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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 Layer* mask_layer = layer->mask_layer(); | 947 Layer* mask_layer = layer->mask_layer(); |
948 if (mask_layer) { | 948 if (mask_layer) { |
949 mask_layer->CalculateContentsScale( | 949 mask_layer->CalculateContentsScale( |
950 contents_scale, | 950 contents_scale, |
951 &mask_layer->draw_properties().contents_scale_x, | 951 &mask_layer->draw_properties().contents_scale_x, |
952 &mask_layer->draw_properties().contents_scale_y, | 952 &mask_layer->draw_properties().contents_scale_y, |
953 &mask_layer->draw_properties().content_bounds); | 953 &mask_layer->draw_properties().content_bounds); |
954 } | 954 } |
955 | 955 |
956 Layer* replica_mask_layer = | 956 Layer* replica_mask_layer = |
957 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL; | 957 layer->replica_layer() ? layer->replica_layer()->mask_layer() : nullptr; |
958 if (replica_mask_layer) { | 958 if (replica_mask_layer) { |
959 replica_mask_layer->CalculateContentsScale( | 959 replica_mask_layer->CalculateContentsScale( |
960 contents_scale, | 960 contents_scale, |
961 &replica_mask_layer->draw_properties().contents_scale_x, | 961 &replica_mask_layer->draw_properties().contents_scale_x, |
962 &replica_mask_layer->draw_properties().contents_scale_y, | 962 &replica_mask_layer->draw_properties().contents_scale_y, |
963 &replica_mask_layer->draw_properties().content_bounds); | 963 &replica_mask_layer->draw_properties().content_bounds); |
964 } | 964 } |
965 } | 965 } |
966 | 966 |
967 static inline void UpdateLayerContentsScale( | 967 static inline void UpdateLayerContentsScale( |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 mask_layer, | 1748 mask_layer, |
1749 ideal_contents_scale, | 1749 ideal_contents_scale, |
1750 combined_maximum_animation_contents_scale, | 1750 combined_maximum_animation_contents_scale, |
1751 data_from_ancestor.in_subtree_of_page_scale_application_layer | 1751 data_from_ancestor.in_subtree_of_page_scale_application_layer |
1752 ? globals.page_scale_factor | 1752 ? globals.page_scale_factor |
1753 : 1.f, | 1753 : 1.f, |
1754 globals.device_scale_factor); | 1754 globals.device_scale_factor); |
1755 } | 1755 } |
1756 | 1756 |
1757 LayerType* replica_mask_layer = | 1757 LayerType* replica_mask_layer = |
1758 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL; | 1758 layer->replica_layer() ? layer->replica_layer()->mask_layer() : nullptr; |
1759 if (replica_mask_layer) { | 1759 if (replica_mask_layer) { |
1760 UpdateLayerScaleDrawProperties( | 1760 UpdateLayerScaleDrawProperties( |
1761 replica_mask_layer, | 1761 replica_mask_layer, |
1762 ideal_contents_scale, | 1762 ideal_contents_scale, |
1763 combined_maximum_animation_contents_scale, | 1763 combined_maximum_animation_contents_scale, |
1764 data_from_ancestor.in_subtree_of_page_scale_application_layer | 1764 data_from_ancestor.in_subtree_of_page_scale_application_layer |
1765 ? globals.page_scale_factor | 1765 ? globals.page_scale_factor |
1766 : 1.f, | 1766 : 1.f, |
1767 globals.device_scale_factor); | 1767 globals.device_scale_factor); |
1768 } | 1768 } |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 MathUtil::ComputeTransform2dScaleComponents(inputs.device_transform, 1.f); | 2354 MathUtil::ComputeTransform2dScaleComponents(inputs.device_transform, 1.f); |
2355 // Not handling the rare case of different x and y device scale. | 2355 // Not handling the rare case of different x and y device scale. |
2356 float device_transform_scale = | 2356 float device_transform_scale = |
2357 std::max(device_transform_scale_components.x(), | 2357 std::max(device_transform_scale_components.x(), |
2358 device_transform_scale_components.y()); | 2358 device_transform_scale_components.y()); |
2359 | 2359 |
2360 gfx::Transform scaled_device_transform = inputs.device_transform; | 2360 gfx::Transform scaled_device_transform = inputs.device_transform; |
2361 scaled_device_transform.Scale(inputs.device_scale_factor, | 2361 scaled_device_transform.Scale(inputs.device_scale_factor, |
2362 inputs.device_scale_factor); | 2362 inputs.device_scale_factor); |
2363 | 2363 |
2364 globals->layer_sorter = NULL; | 2364 globals->layer_sorter = nullptr; |
2365 globals->max_texture_size = inputs.max_texture_size; | 2365 globals->max_texture_size = inputs.max_texture_size; |
2366 globals->device_scale_factor = | 2366 globals->device_scale_factor = |
2367 inputs.device_scale_factor * device_transform_scale; | 2367 inputs.device_scale_factor * device_transform_scale; |
2368 globals->page_scale_factor = inputs.page_scale_factor; | 2368 globals->page_scale_factor = inputs.page_scale_factor; |
2369 globals->page_scale_application_layer = inputs.page_scale_application_layer; | 2369 globals->page_scale_application_layer = inputs.page_scale_application_layer; |
2370 globals->can_render_to_separate_surface = | 2370 globals->can_render_to_separate_surface = |
2371 inputs.can_render_to_separate_surface; | 2371 inputs.can_render_to_separate_surface; |
2372 globals->can_adjust_raster_scales = inputs.can_adjust_raster_scales; | 2372 globals->can_adjust_raster_scales = inputs.can_adjust_raster_scales; |
2373 | 2373 |
2374 data_for_recursion->parent_matrix = scaled_device_transform; | 2374 data_for_recursion->parent_matrix = scaled_device_transform; |
2375 data_for_recursion->full_hierarchy_matrix = identity_matrix; | 2375 data_for_recursion->full_hierarchy_matrix = identity_matrix; |
2376 data_for_recursion->scroll_compensation_matrix = identity_matrix; | 2376 data_for_recursion->scroll_compensation_matrix = identity_matrix; |
2377 data_for_recursion->fixed_container = inputs.root_layer; | 2377 data_for_recursion->fixed_container = inputs.root_layer; |
2378 data_for_recursion->clip_rect_in_target_space = device_viewport_rect; | 2378 data_for_recursion->clip_rect_in_target_space = device_viewport_rect; |
2379 data_for_recursion->clip_rect_of_target_surface_in_target_space = | 2379 data_for_recursion->clip_rect_of_target_surface_in_target_space = |
2380 device_viewport_rect; | 2380 device_viewport_rect; |
2381 data_for_recursion->maximum_animation_contents_scale = 0.f; | 2381 data_for_recursion->maximum_animation_contents_scale = 0.f; |
2382 data_for_recursion->ancestor_is_animating_scale = false; | 2382 data_for_recursion->ancestor_is_animating_scale = false; |
2383 data_for_recursion->ancestor_clips_subtree = true; | 2383 data_for_recursion->ancestor_clips_subtree = true; |
2384 data_for_recursion->nearest_occlusion_immune_ancestor_surface = NULL; | 2384 data_for_recursion->nearest_occlusion_immune_ancestor_surface = nullptr; |
2385 data_for_recursion->in_subtree_of_page_scale_application_layer = false; | 2385 data_for_recursion->in_subtree_of_page_scale_application_layer = false; |
2386 data_for_recursion->subtree_can_use_lcd_text = inputs.can_use_lcd_text; | 2386 data_for_recursion->subtree_can_use_lcd_text = inputs.can_use_lcd_text; |
2387 data_for_recursion->subtree_is_visible_from_ancestor = true; | 2387 data_for_recursion->subtree_is_visible_from_ancestor = true; |
2388 } | 2388 } |
2389 | 2389 |
2390 void LayerTreeHostCommon::CalculateDrawProperties( | 2390 void LayerTreeHostCommon::CalculateDrawProperties( |
2391 CalcDrawPropsMainInputs* inputs) { | 2391 CalcDrawPropsMainInputs* inputs) { |
2392 LayerList dummy_layer_list; | 2392 LayerList dummy_layer_list; |
2393 SubtreeGlobals<Layer> globals; | 2393 SubtreeGlobals<Layer> globals; |
2394 DataForRecursion<Layer> data_for_recursion; | 2394 DataForRecursion<Layer> data_for_recursion; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 inputs->current_render_surface_layer_list_id); | 2437 inputs->current_render_surface_layer_list_id); |
2438 | 2438 |
2439 // The dummy layer list should not have been used. | 2439 // The dummy layer list should not have been used. |
2440 DCHECK_EQ(0u, dummy_layer_list.size()); | 2440 DCHECK_EQ(0u, dummy_layer_list.size()); |
2441 // A root layer render_surface should always exist after | 2441 // A root layer render_surface should always exist after |
2442 // CalculateDrawProperties. | 2442 // CalculateDrawProperties. |
2443 DCHECK(inputs->root_layer->render_surface()); | 2443 DCHECK(inputs->root_layer->render_surface()); |
2444 } | 2444 } |
2445 | 2445 |
2446 } // namespace cc | 2446 } // namespace cc |
OLD | NEW |