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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 layer_draw_properties.target_space_transform = combined_transform; | 1809 layer_draw_properties.target_space_transform = combined_transform; |
1810 // M[draw] = M[parent] * LT * S[layer2content] | 1810 // M[draw] = M[parent] * LT * S[layer2content] |
1811 layer_draw_properties.target_space_transform.Scale( | 1811 layer_draw_properties.target_space_transform.Scale( |
1812 SK_MScalar1 / layer->contents_scale_x(), | 1812 SK_MScalar1 / layer->contents_scale_x(), |
1813 SK_MScalar1 / layer->contents_scale_y()); | 1813 SK_MScalar1 / layer->contents_scale_y()); |
1814 | 1814 |
1815 // The layer's screen_space_transform represents the transform between root | 1815 // The layer's screen_space_transform represents the transform between root |
1816 // layer's "screen space" and local content space. | 1816 // layer's "screen space" and local content space. |
1817 layer_draw_properties.screen_space_transform = | 1817 layer_draw_properties.screen_space_transform = |
1818 data_from_ancestor.full_hierarchy_matrix; | 1818 data_from_ancestor.full_hierarchy_matrix; |
1819 if (layer->should_flatten_transform()) | |
1820 layer_draw_properties.screen_space_transform.FlattenTo2d(); | |
1821 layer_draw_properties.screen_space_transform.PreconcatTransform | 1819 layer_draw_properties.screen_space_transform.PreconcatTransform |
1822 (layer_draw_properties.target_space_transform); | 1820 (layer_draw_properties.target_space_transform); |
1823 | 1821 |
1824 // Adjusting text AA method during animation may cause repaints, which in-turn | 1822 // Adjusting text AA method during animation may cause repaints, which in-turn |
1825 // causes jank. | 1823 // causes jank. |
1826 bool adjust_text_aa = | 1824 bool adjust_text_aa = |
1827 !animating_opacity_to_screen && !animating_transform_to_screen; | 1825 !animating_opacity_to_screen && !animating_transform_to_screen; |
1828 bool layer_can_use_lcd_text = true; | 1826 bool layer_can_use_lcd_text = true; |
1829 bool subtree_can_use_lcd_text = true; | 1827 bool subtree_can_use_lcd_text = true; |
1830 if (!globals.layers_always_allowed_lcd_text) { | 1828 if (!globals.layers_always_allowed_lcd_text) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 layer_draw_properties.target_space_transform_is_animating = | 1927 layer_draw_properties.target_space_transform_is_animating = |
1930 animating_transform_to_target; | 1928 animating_transform_to_target; |
1931 layer_draw_properties.screen_space_transform_is_animating = | 1929 layer_draw_properties.screen_space_transform_is_animating = |
1932 animating_transform_to_screen; | 1930 animating_transform_to_screen; |
1933 | 1931 |
1934 // Update the aggregate hierarchy matrix to include the transform of the | 1932 // Update the aggregate hierarchy matrix to include the transform of the |
1935 // newly created RenderSurfaceImpl. | 1933 // newly created RenderSurfaceImpl. |
1936 data_for_children.full_hierarchy_matrix.PreconcatTransform( | 1934 data_for_children.full_hierarchy_matrix.PreconcatTransform( |
1937 render_surface->draw_transform()); | 1935 render_surface->draw_transform()); |
1938 | 1936 |
| 1937 // A render surface inherently acts as a flattening point for the content of |
| 1938 // its descendants. |
| 1939 data_for_children.full_hierarchy_matrix.FlattenTo2d(); |
| 1940 |
1939 if (layer->mask_layer()) { | 1941 if (layer->mask_layer()) { |
1940 DrawProperties<LayerType>& mask_layer_draw_properties = | 1942 DrawProperties<LayerType>& mask_layer_draw_properties = |
1941 layer->mask_layer()->draw_properties(); | 1943 layer->mask_layer()->draw_properties(); |
1942 mask_layer_draw_properties.render_target = layer; | 1944 mask_layer_draw_properties.render_target = layer; |
1943 mask_layer_draw_properties.visible_content_rect = | 1945 mask_layer_draw_properties.visible_content_rect = |
1944 gfx::Rect(layer->content_bounds()); | 1946 gfx::Rect(layer->content_bounds()); |
1945 } | 1947 } |
1946 | 1948 |
1947 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { | 1949 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { |
1948 DrawProperties<LayerType>& replica_mask_draw_properties = | 1950 DrawProperties<LayerType>& replica_mask_draw_properties = |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 inputs->current_render_surface_layer_list_id); | 2599 inputs->current_render_surface_layer_list_id); |
2598 | 2600 |
2599 // The dummy layer list should not have been used. | 2601 // The dummy layer list should not have been used. |
2600 DCHECK_EQ(0u, dummy_layer_list.size()); | 2602 DCHECK_EQ(0u, dummy_layer_list.size()); |
2601 // A root layer render_surface should always exist after | 2603 // A root layer render_surface should always exist after |
2602 // CalculateDrawProperties. | 2604 // CalculateDrawProperties. |
2603 DCHECK(inputs->root_layer->render_surface()); | 2605 DCHECK(inputs->root_layer->render_surface()); |
2604 } | 2606 } |
2605 | 2607 |
2606 } // namespace cc | 2608 } // namespace cc |
OLD | NEW |