| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 should_flatten_transform_from_property_tree_(false), | 63 should_flatten_transform_from_property_tree_(false), |
| 64 layer_property_changed_(false), | 64 layer_property_changed_(false), |
| 65 masks_to_bounds_(false), | 65 masks_to_bounds_(false), |
| 66 contents_opaque_(false), | 66 contents_opaque_(false), |
| 67 is_root_for_isolated_group_(false), | 67 is_root_for_isolated_group_(false), |
| 68 use_parent_backface_visibility_(false), | 68 use_parent_backface_visibility_(false), |
| 69 use_local_transform_for_backface_visibility_(false), | 69 use_local_transform_for_backface_visibility_(false), |
| 70 should_check_backface_visibility_(false), | 70 should_check_backface_visibility_(false), |
| 71 draws_content_(false), | 71 draws_content_(false), |
| 72 hide_layer_and_subtree_(false), | 72 hide_layer_and_subtree_(false), |
| 73 transform_is_invertible_(true), | |
| 74 is_container_for_fixed_position_layers_(false), | 73 is_container_for_fixed_position_layers_(false), |
| 75 is_affected_by_page_scale_(true), | 74 is_affected_by_page_scale_(true), |
| 76 was_ever_ready_since_last_transform_animation_(true), | 75 was_ever_ready_since_last_transform_animation_(true), |
| 77 background_color_(0), | 76 background_color_(0), |
| 78 safe_opaque_background_color_(0), | 77 safe_opaque_background_color_(0), |
| 79 opacity_(1.0), | 78 opacity_(1.0), |
| 80 blend_mode_(SkXfermode::kSrcOver_Mode), | 79 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 81 draw_blend_mode_(SkXfermode::kSrcOver_Mode), | 80 draw_blend_mode_(SkXfermode::kSrcOver_Mode), |
| 82 num_descendants_that_draw_content_(0), | 81 num_descendants_that_draw_content_(0), |
| 83 transform_tree_index_(-1), | 82 transform_tree_index_(-1), |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 is_container_for_fixed_position_layers_); | 515 is_container_for_fixed_position_layers_); |
| 517 layer->SetPositionConstraint(position_constraint_); | 516 layer->SetPositionConstraint(position_constraint_); |
| 518 layer->SetShouldFlattenTransform(should_flatten_transform_); | 517 layer->SetShouldFlattenTransform(should_flatten_transform_); |
| 519 layer->set_should_flatten_transform_from_property_tree( | 518 layer->set_should_flatten_transform_from_property_tree( |
| 520 should_flatten_transform_from_property_tree_); | 519 should_flatten_transform_from_property_tree_); |
| 521 layer->set_draw_blend_mode(draw_blend_mode_); | 520 layer->set_draw_blend_mode(draw_blend_mode_); |
| 522 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 521 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
| 523 layer->SetUseLocalTransformForBackfaceVisibility( | 522 layer->SetUseLocalTransformForBackfaceVisibility( |
| 524 use_local_transform_for_backface_visibility_); | 523 use_local_transform_for_backface_visibility_); |
| 525 layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_); | 524 layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_); |
| 526 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); | 525 layer->SetTransform(transform_); |
| 527 if (layer_property_changed_) | 526 if (layer_property_changed_) |
| 528 layer->NoteLayerPropertyChanged(); | 527 layer->NoteLayerPropertyChanged(); |
| 529 | 528 |
| 530 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 529 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 531 layer->SetElementId(element_id_); | 530 layer->SetElementId(element_id_); |
| 532 layer->SetMutableProperties(mutable_properties_); | 531 layer->SetMutableProperties(mutable_properties_); |
| 533 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 532 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 534 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 533 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
| 535 | 534 |
| 536 layer->Set3dSortingContextId(sorting_context_id_); | 535 layer->Set3dSortingContextId(sorting_context_id_); |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 void LayerImpl::GatherFrameTimingRequestIds(std::vector<int64_t>* request_ids) { | 1223 void LayerImpl::GatherFrameTimingRequestIds(std::vector<int64_t>* request_ids) { |
| 1225 for (const auto& request : frame_timing_requests_) | 1224 for (const auto& request : frame_timing_requests_) |
| 1226 request_ids->push_back(request.id()); | 1225 request_ids->push_back(request.id()); |
| 1227 } | 1226 } |
| 1228 | 1227 |
| 1229 void LayerImpl::SetTransform(const gfx::Transform& transform) { | 1228 void LayerImpl::SetTransform(const gfx::Transform& transform) { |
| 1230 if (transform_ == transform) | 1229 if (transform_ == transform) |
| 1231 return; | 1230 return; |
| 1232 | 1231 |
| 1233 transform_ = transform; | 1232 transform_ = transform; |
| 1234 transform_is_invertible_ = transform_.IsInvertible(); | |
| 1235 } | |
| 1236 | |
| 1237 void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform, | |
| 1238 bool transform_is_invertible) { | |
| 1239 if (transform_ == transform) { | |
| 1240 DCHECK(transform_is_invertible_ == transform_is_invertible) | |
| 1241 << "Can't change invertibility if transform is unchanged"; | |
| 1242 return; | |
| 1243 } | |
| 1244 transform_ = transform; | |
| 1245 transform_is_invertible_ = transform_is_invertible; | |
| 1246 } | 1233 } |
| 1247 | 1234 |
| 1248 bool LayerImpl::TransformIsAnimating() const { | 1235 bool LayerImpl::TransformIsAnimating() const { |
| 1249 return layer_tree_impl_->IsAnimatingTransformProperty(this); | 1236 return layer_tree_impl_->IsAnimatingTransformProperty(this); |
| 1250 } | 1237 } |
| 1251 | 1238 |
| 1252 bool LayerImpl::HasPotentiallyRunningTransformAnimation() const { | 1239 bool LayerImpl::HasPotentiallyRunningTransformAnimation() const { |
| 1253 return layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this); | 1240 return layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this); |
| 1254 } | 1241 } |
| 1255 | 1242 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1633 .layer_transforms_should_scale_layer_contents) { | 1620 .layer_transforms_should_scale_layer_contents) { |
| 1634 return default_scale; | 1621 return default_scale; |
| 1635 } | 1622 } |
| 1636 | 1623 |
| 1637 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1624 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1638 DrawTransform(), default_scale); | 1625 DrawTransform(), default_scale); |
| 1639 return std::max(transform_scales.x(), transform_scales.y()); | 1626 return std::max(transform_scales.x(), transform_scales.y()); |
| 1640 } | 1627 } |
| 1641 | 1628 |
| 1642 } // namespace cc | 1629 } // namespace cc |
| OLD | NEW |