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

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

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

Powered by Google App Engine
This is Rietveld 408576698