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

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

Issue 2026033002: cc: Remove can_use_lcd_text from draw properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/draw_property_utils.h" 5 #include "cc/trees/draw_property_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 // (included) and its target surface (excluded). 1007 // (included) and its target surface (excluded).
1008 const EffectNode* node = tree.Node(render_surface->EffectTreeIndex()); 1008 const EffectNode* node = tree.Node(render_surface->EffectTreeIndex());
1009 float draw_opacity = tree.EffectiveOpacity(node); 1009 float draw_opacity = tree.EffectiveOpacity(node);
1010 for (node = tree.parent(node); node && !node->data.has_render_surface; 1010 for (node = tree.parent(node); node && !node->data.has_render_surface;
1011 node = tree.parent(node)) { 1011 node = tree.parent(node)) {
1012 draw_opacity *= tree.EffectiveOpacity(node); 1012 draw_opacity *= tree.EffectiveOpacity(node);
1013 } 1013 }
1014 render_surface->SetDrawOpacity(draw_opacity); 1014 render_surface->SetDrawOpacity(draw_opacity);
1015 } 1015 }
1016 1016
1017 static bool LayerCanUseLcdText(const LayerImpl* layer,
1018 bool layers_always_allowed_lcd_text,
1019 bool can_use_lcd_text,
1020 const TransformNode* transform_node,
1021 const EffectNode* effect_node) {
1022 if (layers_always_allowed_lcd_text)
1023 return true;
1024 if (!can_use_lcd_text)
1025 return false;
1026 if (!layer->contents_opaque())
1027 return false;
1028
1029 if (effect_node->data.screen_space_opacity != 1.f)
1030 return false;
1031 if (!transform_node->data.node_and_ancestors_have_only_integer_translation)
1032 return false;
1033 if (static_cast<int>(layer->offset_to_transform_parent().x()) !=
1034 layer->offset_to_transform_parent().x())
1035 return false;
1036 if (static_cast<int>(layer->offset_to_transform_parent().y()) !=
1037 layer->offset_to_transform_parent().y())
1038 return false;
1039 return true;
1040 }
1041
1042 static gfx::Rect LayerDrawableContentRect( 1017 static gfx::Rect LayerDrawableContentRect(
1043 const LayerImpl* layer, 1018 const LayerImpl* layer,
1044 const gfx::Rect& layer_bounds_in_target_space, 1019 const gfx::Rect& layer_bounds_in_target_space,
1045 const gfx::Rect& clip_rect) { 1020 const gfx::Rect& clip_rect) {
1046 if (layer->is_clipped()) 1021 if (layer->is_clipped())
1047 return IntersectRects(layer_bounds_in_target_space, clip_rect); 1022 return IntersectRects(layer_bounds_in_target_space, clip_rect);
1048 1023
1049 return layer_bounds_in_target_space; 1024 return layer_bounds_in_target_space;
1050 } 1025 }
1051 1026
(...skipping 18 matching lines...) Expand all
1070 if (surface_transform_node->data.sublayer_scale.x() != 0 && 1045 if (surface_transform_node->data.sublayer_scale.x() != 0 &&
1071 surface_transform_node->data.sublayer_scale.y() != 0) { 1046 surface_transform_node->data.sublayer_scale.y() != 0) {
1072 replica_to_surface.Scale( 1047 replica_to_surface.Scale(
1073 1.0 / surface_transform_node->data.sublayer_scale.x(), 1048 1.0 / surface_transform_node->data.sublayer_scale.x(),
1074 1.0 / surface_transform_node->data.sublayer_scale.y()); 1049 1.0 / surface_transform_node->data.sublayer_scale.y());
1075 } 1050 }
1076 return replica_to_surface; 1051 return replica_to_surface;
1077 } 1052 }
1078 1053
1079 void ComputeLayerDrawProperties(LayerImpl* layer, 1054 void ComputeLayerDrawProperties(LayerImpl* layer,
1080 const PropertyTrees* property_trees, 1055 const PropertyTrees* property_trees) {
1081 bool layers_always_allowed_lcd_text,
1082 bool can_use_lcd_text) {
1083 const TransformNode* transform_node = 1056 const TransformNode* transform_node =
1084 property_trees->transform_tree.Node(layer->transform_tree_index()); 1057 property_trees->transform_tree.Node(layer->transform_tree_index());
1085 const EffectNode* effect_node =
1086 property_trees->effect_tree.Node(layer->effect_tree_index());
1087 const ClipNode* clip_node = 1058 const ClipNode* clip_node =
1088 property_trees->clip_tree.Node(layer->clip_tree_index()); 1059 property_trees->clip_tree.Node(layer->clip_tree_index());
1089 1060
1090 layer->draw_properties().screen_space_transform = 1061 layer->draw_properties().screen_space_transform =
1091 ScreenSpaceTransformInternal(layer, transform_node); 1062 ScreenSpaceTransformInternal(layer, transform_node);
1092 if (property_trees->non_root_surfaces_enabled) { 1063 if (property_trees->non_root_surfaces_enabled) {
1093 layer->draw_properties().target_space_transform = 1064 layer->draw_properties().target_space_transform =
1094 DrawTransform(layer, property_trees->transform_tree); 1065 DrawTransform(layer, property_trees->transform_tree);
1095 } else { 1066 } else {
1096 layer->draw_properties().target_space_transform = 1067 layer->draw_properties().target_space_transform =
1097 layer->draw_properties().screen_space_transform; 1068 layer->draw_properties().screen_space_transform;
1098 } 1069 }
1099 layer->draw_properties().screen_space_transform_is_animating = 1070 layer->draw_properties().screen_space_transform_is_animating =
1100 transform_node->data.to_screen_is_potentially_animated; 1071 transform_node->data.to_screen_is_potentially_animated;
1101 if (layer->layer_tree_impl() 1072 if (layer->layer_tree_impl()
1102 ->settings() 1073 ->settings()
1103 .layer_transforms_should_scale_layer_contents) { 1074 .layer_transforms_should_scale_layer_contents) {
1104 layer->draw_properties().maximum_animation_contents_scale = 1075 layer->draw_properties().maximum_animation_contents_scale =
1105 transform_node->data.combined_maximum_animation_target_scale; 1076 transform_node->data.combined_maximum_animation_target_scale;
1106 layer->draw_properties().starting_animation_contents_scale = 1077 layer->draw_properties().starting_animation_contents_scale =
1107 transform_node->data.combined_starting_animation_scale; 1078 transform_node->data.combined_starting_animation_scale;
1108 } else { 1079 } else {
1109 layer->draw_properties().maximum_animation_contents_scale = 0.f; 1080 layer->draw_properties().maximum_animation_contents_scale = 0.f;
1110 layer->draw_properties().starting_animation_contents_scale = 0.f; 1081 layer->draw_properties().starting_animation_contents_scale = 0.f;
1111 } 1082 }
1112 1083
1113 layer->draw_properties().opacity = 1084 layer->draw_properties().opacity =
1114 LayerDrawOpacity(layer, property_trees->effect_tree); 1085 LayerDrawOpacity(layer, property_trees->effect_tree);
1115 layer->draw_properties().can_use_lcd_text =
1116 LayerCanUseLcdText(layer, layers_always_allowed_lcd_text,
1117 can_use_lcd_text, transform_node, effect_node);
1118 if (property_trees->non_root_surfaces_enabled) { 1086 if (property_trees->non_root_surfaces_enabled) {
1119 layer->draw_properties().is_clipped = clip_node->data.layers_are_clipped; 1087 layer->draw_properties().is_clipped = clip_node->data.layers_are_clipped;
1120 } else { 1088 } else {
1121 layer->draw_properties().is_clipped = 1089 layer->draw_properties().is_clipped =
1122 clip_node->data.layers_are_clipped_when_surfaces_disabled; 1090 clip_node->data.layers_are_clipped_when_surfaces_disabled;
1123 } 1091 }
1124 1092
1125 gfx::Rect bounds_in_target_space = MathUtil::MapEnclosingClippedRect( 1093 gfx::Rect bounds_in_target_space = MathUtil::MapEnclosingClippedRect(
1126 layer->draw_properties().target_space_transform, 1094 layer->draw_properties().target_space_transform,
1127 gfx::Rect(layer->bounds())); 1095 gfx::Rect(layer->bounds()));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1221 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1254 const Layer* overscroll_elasticity_layer, 1222 const Layer* overscroll_elasticity_layer,
1255 const gfx::Vector2dF& elastic_overscroll) { 1223 const gfx::Vector2dF& elastic_overscroll) {
1256 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1224 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1257 elastic_overscroll); 1225 elastic_overscroll);
1258 } 1226 }
1259 1227
1260 } // namespace draw_property_utils 1228 } // namespace draw_property_utils
1261 1229
1262 } // namespace cc 1230 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698