Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 1132253003: Observe LCD text restrictions during layer animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: contents_opaque + animation unit test Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698