OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 state->BeginDictionary("mask_layer"); | 1185 state->BeginDictionary("mask_layer"); |
1186 mask_layer_->AsValueInto(state); | 1186 mask_layer_->AsValueInto(state); |
1187 state->EndDictionary(); | 1187 state->EndDictionary(); |
1188 } | 1188 } |
1189 if (replica_layer_) { | 1189 if (replica_layer_) { |
1190 state->BeginDictionary("replica_layer"); | 1190 state->BeginDictionary("replica_layer"); |
1191 replica_layer_->AsValueInto(state); | 1191 replica_layer_->AsValueInto(state); |
1192 state->EndDictionary(); | 1192 state->EndDictionary(); |
1193 } | 1193 } |
1194 | 1194 |
1195 state->SetBoolean("can_use_lcd_text", can_use_lcd_text()); | 1195 state->SetBoolean("can_use_lcd_text", CanUseLCDText()); |
1196 state->SetBoolean("contents_opaque", contents_opaque()); | 1196 state->SetBoolean("contents_opaque", contents_opaque()); |
1197 | 1197 |
1198 state->SetBoolean("has_animation_bounds", | 1198 state->SetBoolean("has_animation_bounds", |
1199 layer_tree_impl_->HasAnimationThatInflatesBounds(this)); | 1199 layer_tree_impl_->HasAnimationThatInflatesBounds(this)); |
1200 | 1200 |
1201 state->SetBoolean("has_will_change_transform_hint", | 1201 state->SetBoolean("has_will_change_transform_hint", |
1202 has_will_change_transform_hint()); | 1202 has_will_change_transform_hint()); |
1203 | 1203 |
1204 gfx::BoxF box; | 1204 gfx::BoxF box; |
1205 if (LayerUtils::GetAnimationBounds(*this, &box)) | 1205 if (LayerUtils::GetAnimationBounds(*this, &box)) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 gfx::Transform LayerImpl::ScreenSpaceTransform() const { | 1261 gfx::Transform LayerImpl::ScreenSpaceTransform() const { |
1262 // Only drawn layers have up-to-date draw properties. | 1262 // Only drawn layers have up-to-date draw properties. |
1263 if (!is_drawn_render_surface_layer_list_member()) { | 1263 if (!is_drawn_render_surface_layer_list_member()) { |
1264 return draw_property_utils::ScreenSpaceTransform( | 1264 return draw_property_utils::ScreenSpaceTransform( |
1265 this, layer_tree_impl()->property_trees()->transform_tree); | 1265 this, layer_tree_impl()->property_trees()->transform_tree); |
1266 } | 1266 } |
1267 | 1267 |
1268 return draw_properties().screen_space_transform; | 1268 return draw_properties().screen_space_transform; |
1269 } | 1269 } |
1270 | 1270 |
| 1271 bool LayerImpl::CanUseLCDText() const { |
| 1272 if (layer_tree_impl()->settings().layers_always_allowed_lcd_text) |
| 1273 return true; |
| 1274 if (!layer_tree_impl()->settings().can_use_lcd_text) |
| 1275 return false; |
| 1276 if (!contents_opaque()) |
| 1277 return false; |
| 1278 |
| 1279 if (layer_tree_impl() |
| 1280 ->property_trees() |
| 1281 ->effect_tree.Node(effect_tree_index()) |
| 1282 ->data.screen_space_opacity != 1.f) |
| 1283 return false; |
| 1284 if (!layer_tree_impl() |
| 1285 ->property_trees() |
| 1286 ->transform_tree.Node(transform_tree_index()) |
| 1287 ->data.node_and_ancestors_have_only_integer_translation) |
| 1288 return false; |
| 1289 if (static_cast<int>(offset_to_transform_parent().x()) != |
| 1290 offset_to_transform_parent().x()) |
| 1291 return false; |
| 1292 if (static_cast<int>(offset_to_transform_parent().y()) != |
| 1293 offset_to_transform_parent().y()) |
| 1294 return false; |
| 1295 return true; |
| 1296 } |
| 1297 |
1271 Region LayerImpl::GetInvalidationRegionForDebugging() { | 1298 Region LayerImpl::GetInvalidationRegionForDebugging() { |
1272 return Region(update_rect_); | 1299 return Region(update_rect_); |
1273 } | 1300 } |
1274 | 1301 |
1275 gfx::Rect LayerImpl::GetEnclosingRectInTargetSpace() const { | 1302 gfx::Rect LayerImpl::GetEnclosingRectInTargetSpace() const { |
1276 return MathUtil::MapEnclosingClippedRect(DrawTransform(), | 1303 return MathUtil::MapEnclosingClippedRect(DrawTransform(), |
1277 gfx::Rect(bounds())); | 1304 gfx::Rect(bounds())); |
1278 } | 1305 } |
1279 | 1306 |
1280 gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const { | 1307 gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 .layer_transforms_should_scale_layer_contents) { | 1368 .layer_transforms_should_scale_layer_contents) { |
1342 return default_scale; | 1369 return default_scale; |
1343 } | 1370 } |
1344 | 1371 |
1345 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1372 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
1346 ScreenSpaceTransform(), default_scale); | 1373 ScreenSpaceTransform(), default_scale); |
1347 return std::max(transform_scales.x(), transform_scales.y()); | 1374 return std::max(transform_scales.x(), transform_scales.y()); |
1348 } | 1375 } |
1349 | 1376 |
1350 } // namespace cc | 1377 } // namespace cc |
OLD | NEW |