| 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 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 SK_MScalar1 / layer->contents_scale_x(), | 1890 SK_MScalar1 / layer->contents_scale_x(), |
| 1891 SK_MScalar1 / layer->contents_scale_y()); | 1891 SK_MScalar1 / layer->contents_scale_y()); |
| 1892 | 1892 |
| 1893 // The layer's screen_space_transform represents the transform between root | 1893 // The layer's screen_space_transform represents the transform between root |
| 1894 // layer's "screen space" and local content space. | 1894 // layer's "screen space" and local content space. |
| 1895 layer_draw_properties.screen_space_transform = | 1895 layer_draw_properties.screen_space_transform = |
| 1896 data_from_ancestor.full_hierarchy_matrix; | 1896 data_from_ancestor.full_hierarchy_matrix; |
| 1897 layer_draw_properties.screen_space_transform.PreconcatTransform | 1897 layer_draw_properties.screen_space_transform.PreconcatTransform |
| 1898 (layer_draw_properties.target_space_transform); | 1898 (layer_draw_properties.target_space_transform); |
| 1899 | 1899 |
| 1900 // Adjusting text AA method during animation may cause repaints, which in-turn | |
| 1901 // causes jank. | |
| 1902 bool adjust_text_aa = | |
| 1903 !animating_opacity_to_screen && !animating_transform_to_screen; | |
| 1904 bool layer_can_use_lcd_text = true; | 1900 bool layer_can_use_lcd_text = true; |
| 1905 bool subtree_can_use_lcd_text = true; | 1901 bool subtree_can_use_lcd_text = true; |
| 1906 if (!globals.layers_always_allowed_lcd_text) { | 1902 if (!globals.layers_always_allowed_lcd_text) { |
| 1907 // To avoid color fringing, LCD text should only be used on opaque layers | 1903 // To avoid color fringing, LCD text should only be used on opaque layers |
| 1908 // with just integral translation. | 1904 // with just integral translation. |
| 1909 subtree_can_use_lcd_text = data_from_ancestor.subtree_can_use_lcd_text && | 1905 subtree_can_use_lcd_text = data_from_ancestor.subtree_can_use_lcd_text && |
| 1910 accumulated_draw_opacity == 1.f && | 1906 accumulated_draw_opacity == 1.f && |
| 1911 layer_draw_properties.target_space_transform | 1907 layer_draw_properties.target_space_transform |
| 1912 .IsIdentityOrIntegerTranslation(); | 1908 .IsIdentityOrIntegerTranslation(); |
| 1913 // Also disable LCD text locally for non-opaque content. | 1909 // Also disable LCD text locally for non-opaque content. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 // The surface's cached clip rect value propagates regardless of what | 2134 // The surface's cached clip rect value propagates regardless of what |
| 2139 // clipping goes on between layers here. | 2135 // clipping goes on between layers here. |
| 2140 clip_rect_of_target_surface_in_target_space = | 2136 clip_rect_of_target_surface_in_target_space = |
| 2141 data_from_ancestor.clip_rect_of_target_surface_in_target_space; | 2137 data_from_ancestor.clip_rect_of_target_surface_in_target_space; |
| 2142 | 2138 |
| 2143 // Layers that are not their own render_target will render into the target | 2139 // Layers that are not their own render_target will render into the target |
| 2144 // of their nearest ancestor. | 2140 // of their nearest ancestor. |
| 2145 layer_draw_properties.render_target = layer->parent()->render_target(); | 2141 layer_draw_properties.render_target = layer->parent()->render_target(); |
| 2146 } | 2142 } |
| 2147 | 2143 |
| 2148 if (adjust_text_aa) | 2144 layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text; |
| 2149 layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text; | |
| 2150 | 2145 |
| 2151 gfx::Size content_size_affected_by_delta(layer->content_bounds()); | 2146 gfx::Size content_size_affected_by_delta(layer->content_bounds()); |
| 2152 | 2147 |
| 2153 // Non-zero BoundsDelta imply the contents_scale of 1.0 | 2148 // Non-zero BoundsDelta imply the contents_scale of 1.0 |
| 2154 // because BoundsDela is only set on Android where | 2149 // because BoundsDela is only set on Android where |
| 2155 // ContentScalingLayer is never used. | 2150 // ContentScalingLayer is never used. |
| 2156 DCHECK_IMPLIES(!BoundsDelta(layer).IsZero(), | 2151 DCHECK_IMPLIES(!BoundsDelta(layer).IsZero(), |
| 2157 (layer->contents_scale_x() == 1.0 && | 2152 (layer->contents_scale_x() == 1.0 && |
| 2158 layer->contents_scale_y() == 1.0)); | 2153 layer->contents_scale_y() == 1.0)); |
| 2159 | 2154 |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 PropertyTrees* trees_from_inputs) { | 2751 PropertyTrees* trees_from_inputs) { |
| 2757 return layer->layer_tree_host()->property_trees(); | 2752 return layer->layer_tree_host()->property_trees(); |
| 2758 } | 2753 } |
| 2759 | 2754 |
| 2760 PropertyTrees* GetPropertyTrees(LayerImpl* layer, | 2755 PropertyTrees* GetPropertyTrees(LayerImpl* layer, |
| 2761 PropertyTrees* trees_from_inputs) { | 2756 PropertyTrees* trees_from_inputs) { |
| 2762 return trees_from_inputs; | 2757 return trees_from_inputs; |
| 2763 } | 2758 } |
| 2764 | 2759 |
| 2765 } // namespace cc | 2760 } // namespace cc |
| OLD | NEW |