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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 | 1262 |
1263 template <typename LayerType> | 1263 template <typename LayerType> |
1264 struct SubtreeGlobals { | 1264 struct SubtreeGlobals { |
1265 LayerSorter* layer_sorter; | 1265 LayerSorter* layer_sorter; |
1266 int max_texture_size; | 1266 int max_texture_size; |
1267 float device_scale_factor; | 1267 float device_scale_factor; |
1268 float page_scale_factor; | 1268 float page_scale_factor; |
1269 const LayerType* page_scale_application_layer; | 1269 const LayerType* page_scale_application_layer; |
1270 bool can_adjust_raster_scales; | 1270 bool can_adjust_raster_scales; |
1271 bool can_render_to_separate_surface; | 1271 bool can_render_to_separate_surface; |
1272 bool layers_always_allowed_lcd_text; | |
1273 }; | 1272 }; |
1274 | 1273 |
1275 template<typename LayerType> | 1274 template<typename LayerType> |
1276 struct DataForRecursion { | 1275 struct DataForRecursion { |
1277 // The accumulated sequence of transforms a layer will use to determine its | 1276 // The accumulated sequence of transforms a layer will use to determine its |
1278 // own draw transform. | 1277 // own draw transform. |
1279 gfx::Transform parent_matrix; | 1278 gfx::Transform parent_matrix; |
1280 | 1279 |
1281 // The accumulated sequence of transforms a layer will use to determine its | 1280 // The accumulated sequence of transforms a layer will use to determine its |
1282 // own screen-space transform. | 1281 // own screen-space transform. |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 data_from_ancestor.full_hierarchy_matrix; | 1784 data_from_ancestor.full_hierarchy_matrix; |
1786 if (layer->should_flatten_transform()) | 1785 if (layer->should_flatten_transform()) |
1787 layer_draw_properties.screen_space_transform.FlattenTo2d(); | 1786 layer_draw_properties.screen_space_transform.FlattenTo2d(); |
1788 layer_draw_properties.screen_space_transform.PreconcatTransform | 1787 layer_draw_properties.screen_space_transform.PreconcatTransform |
1789 (layer_draw_properties.target_space_transform); | 1788 (layer_draw_properties.target_space_transform); |
1790 | 1789 |
1791 // Adjusting text AA method during animation may cause repaints, which in-turn | 1790 // Adjusting text AA method during animation may cause repaints, which in-turn |
1792 // causes jank. | 1791 // causes jank. |
1793 bool adjust_text_aa = | 1792 bool adjust_text_aa = |
1794 !animating_opacity_to_screen && !animating_transform_to_screen; | 1793 !animating_opacity_to_screen && !animating_transform_to_screen; |
1795 bool layer_can_use_lcd_text = true; | 1794 // To avoid color fringing, LCD text should only be used on opaque layers with |
1796 if (!globals.layers_always_allowed_lcd_text) { | 1795 // just integral translation. |
1797 // To avoid color fringing, LCD text should only be used on opaque layers | 1796 bool layer_can_use_lcd_text = |
1798 // with just integral translation. | 1797 data_from_ancestor.subtree_can_use_lcd_text && |
1799 layer_can_use_lcd_text = data_from_ancestor.subtree_can_use_lcd_text && | 1798 accumulated_draw_opacity == 1.f && |
1800 accumulated_draw_opacity == 1.f && | 1799 layer_draw_properties.target_space_transform. |
1801 layer_draw_properties.target_space_transform | 1800 IsIdentityOrIntegerTranslation(); |
1802 .IsIdentityOrIntegerTranslation(); | |
1803 } | |
1804 | 1801 |
1805 gfx::Rect content_rect(layer->content_bounds()); | 1802 gfx::Rect content_rect(layer->content_bounds()); |
1806 | 1803 |
1807 // full_hierarchy_matrix is the matrix that transforms objects between screen | 1804 // full_hierarchy_matrix is the matrix that transforms objects between screen |
1808 // space (except projection matrix) and the most recent RenderSurfaceImpl's | 1805 // space (except projection matrix) and the most recent RenderSurfaceImpl's |
1809 // space. next_hierarchy_matrix will only change if this layer uses a new | 1806 // space. next_hierarchy_matrix will only change if this layer uses a new |
1810 // RenderSurfaceImpl, otherwise remains the same. | 1807 // RenderSurfaceImpl, otherwise remains the same. |
1811 data_for_children.full_hierarchy_matrix = | 1808 data_for_children.full_hierarchy_matrix = |
1812 data_from_ancestor.full_hierarchy_matrix; | 1809 data_from_ancestor.full_hierarchy_matrix; |
1813 | 1810 |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 | 2367 |
2371 globals->layer_sorter = NULL; | 2368 globals->layer_sorter = NULL; |
2372 globals->max_texture_size = inputs.max_texture_size; | 2369 globals->max_texture_size = inputs.max_texture_size; |
2373 globals->device_scale_factor = | 2370 globals->device_scale_factor = |
2374 inputs.device_scale_factor * device_transform_scale; | 2371 inputs.device_scale_factor * device_transform_scale; |
2375 globals->page_scale_factor = inputs.page_scale_factor; | 2372 globals->page_scale_factor = inputs.page_scale_factor; |
2376 globals->page_scale_application_layer = inputs.page_scale_application_layer; | 2373 globals->page_scale_application_layer = inputs.page_scale_application_layer; |
2377 globals->can_render_to_separate_surface = | 2374 globals->can_render_to_separate_surface = |
2378 inputs.can_render_to_separate_surface; | 2375 inputs.can_render_to_separate_surface; |
2379 globals->can_adjust_raster_scales = inputs.can_adjust_raster_scales; | 2376 globals->can_adjust_raster_scales = inputs.can_adjust_raster_scales; |
2380 globals->layers_always_allowed_lcd_text = | |
2381 inputs.layers_always_allowed_lcd_text; | |
2382 | 2377 |
2383 data_for_recursion->parent_matrix = scaled_device_transform; | 2378 data_for_recursion->parent_matrix = scaled_device_transform; |
2384 data_for_recursion->full_hierarchy_matrix = identity_matrix; | 2379 data_for_recursion->full_hierarchy_matrix = identity_matrix; |
2385 data_for_recursion->scroll_compensation_matrix = identity_matrix; | 2380 data_for_recursion->scroll_compensation_matrix = identity_matrix; |
2386 data_for_recursion->fixed_container = inputs.root_layer; | 2381 data_for_recursion->fixed_container = inputs.root_layer; |
2387 data_for_recursion->clip_rect_in_target_space = device_viewport_rect; | 2382 data_for_recursion->clip_rect_in_target_space = device_viewport_rect; |
2388 data_for_recursion->clip_rect_of_target_surface_in_target_space = | 2383 data_for_recursion->clip_rect_of_target_surface_in_target_space = |
2389 device_viewport_rect; | 2384 device_viewport_rect; |
2390 data_for_recursion->maximum_animation_contents_scale = 0.f; | 2385 data_for_recursion->maximum_animation_contents_scale = 0.f; |
2391 data_for_recursion->ancestor_is_animating_scale = false; | 2386 data_for_recursion->ancestor_is_animating_scale = false; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 inputs->current_render_surface_layer_list_id); | 2440 inputs->current_render_surface_layer_list_id); |
2446 | 2441 |
2447 // The dummy layer list should not have been used. | 2442 // The dummy layer list should not have been used. |
2448 DCHECK_EQ(0u, dummy_layer_list.size()); | 2443 DCHECK_EQ(0u, dummy_layer_list.size()); |
2449 // A root layer render_surface should always exist after | 2444 // A root layer render_surface should always exist after |
2450 // CalculateDrawProperties. | 2445 // CalculateDrawProperties. |
2451 DCHECK(inputs->root_layer->render_surface()); | 2446 DCHECK(inputs->root_layer->render_surface()); |
2452 } | 2447 } |
2453 | 2448 |
2454 } // namespace cc | 2449 } // namespace cc |
OLD | NEW |