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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 737943002: Update from https://crrev.com/304715 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 0ff66084cc76ad08a064d933edc6058dde880d18..6863850c97b01c7e98fac52450e1609742ec8948 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -1269,6 +1269,7 @@ struct SubtreeGlobals {
const LayerType* page_scale_application_layer;
bool can_adjust_raster_scales;
bool can_render_to_separate_surface;
+ bool layers_always_allowed_lcd_text;
};
template<typename LayerType>
@@ -1791,13 +1792,19 @@ static void CalculateDrawPropertiesInternal(
// causes jank.
bool adjust_text_aa =
!animating_opacity_to_screen && !animating_transform_to_screen;
- // To avoid color fringing, LCD text should only be used on opaque layers with
- // just integral translation.
- bool layer_can_use_lcd_text =
- data_from_ancestor.subtree_can_use_lcd_text &&
- accumulated_draw_opacity == 1.f &&
- layer_draw_properties.target_space_transform.
- IsIdentityOrIntegerTranslation();
+ bool layer_can_use_lcd_text = true;
+ bool subtree_can_use_lcd_text = true;
+ if (!globals.layers_always_allowed_lcd_text) {
+ // To avoid color fringing, LCD text should only be used on opaque layers
+ // with just integral translation.
+ subtree_can_use_lcd_text = data_from_ancestor.subtree_can_use_lcd_text &&
+ accumulated_draw_opacity == 1.f &&
+ layer_draw_properties.target_space_transform
+ .IsIdentityOrIntegerTranslation();
+ // Also disable LCD text locally for non-opaque content.
+ layer_can_use_lcd_text = subtree_can_use_lcd_text &&
+ layer->contents_opaque();
+ }
gfx::Rect content_rect(layer->content_bounds());
@@ -1995,7 +2002,7 @@ static void CalculateDrawPropertiesInternal(
// If the new render surface is drawn translucent or with a non-integral
// translation then the subtree that gets drawn on this render surface
// cannot use LCD text.
- data_for_children.subtree_can_use_lcd_text = layer_can_use_lcd_text;
+ data_for_children.subtree_can_use_lcd_text = subtree_can_use_lcd_text;
render_surface_layer_list->push_back(layer);
} else {
@@ -2374,6 +2381,8 @@ static void ProcessCalcDrawPropsInputs(
globals->can_render_to_separate_surface =
inputs.can_render_to_separate_surface;
globals->can_adjust_raster_scales = inputs.can_adjust_raster_scales;
+ globals->layers_always_allowed_lcd_text =
+ inputs.layers_always_allowed_lcd_text;
data_for_recursion->parent_matrix = scaled_device_transform;
data_for_recursion->full_hierarchy_matrix = identity_matrix;
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698