| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.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 "base/location.h" | 10 #include "base/location.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 is_drawable_(false), | 52 is_drawable_(false), |
| 53 hide_layer_and_subtree_(false), | 53 hide_layer_and_subtree_(false), |
| 54 masks_to_bounds_(false), | 54 masks_to_bounds_(false), |
| 55 contents_opaque_(false), | 55 contents_opaque_(false), |
| 56 double_sided_(true), | 56 double_sided_(true), |
| 57 should_flatten_transform_(true), | 57 should_flatten_transform_(true), |
| 58 use_parent_backface_visibility_(false), | 58 use_parent_backface_visibility_(false), |
| 59 draw_checkerboard_for_missing_tiles_(false), | 59 draw_checkerboard_for_missing_tiles_(false), |
| 60 force_render_surface_(false), | 60 force_render_surface_(false), |
| 61 is_3d_sorted_(false), | 61 is_3d_sorted_(false), |
| 62 transform_is_invertible_(true), |
| 62 anchor_point_(0.5f, 0.5f), | 63 anchor_point_(0.5f, 0.5f), |
| 63 background_color_(0), | 64 background_color_(0), |
| 64 opacity_(1.f), | 65 opacity_(1.f), |
| 65 blend_mode_(SkXfermode::kSrcOver_Mode), | 66 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 66 anchor_point_z_(0.f), | 67 anchor_point_z_(0.f), |
| 67 scroll_parent_(NULL), | 68 scroll_parent_(NULL), |
| 68 clip_parent_(NULL), | 69 clip_parent_(NULL), |
| 69 replica_layer_(NULL), | 70 replica_layer_(NULL), |
| 70 raster_scale_(0.f), | 71 raster_scale_(0.f), |
| 71 client_(NULL) { | 72 client_(NULL) { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 if (parent_ && !parent_->transform_.IsIdentityOrTranslation()) | 599 if (parent_ && !parent_->transform_.IsIdentityOrTranslation()) |
| 599 return true; | 600 return true; |
| 600 return is_container_for_fixed_position_layers_; | 601 return is_container_for_fixed_position_layers_; |
| 601 } | 602 } |
| 602 | 603 |
| 603 void Layer::SetTransform(const gfx::Transform& transform) { | 604 void Layer::SetTransform(const gfx::Transform& transform) { |
| 604 DCHECK(IsPropertyChangeAllowed()); | 605 DCHECK(IsPropertyChangeAllowed()); |
| 605 if (transform_ == transform) | 606 if (transform_ == transform) |
| 606 return; | 607 return; |
| 607 transform_ = transform; | 608 transform_ = transform; |
| 609 transform_is_invertible_ = transform.IsInvertible(); |
| 608 SetNeedsCommit(); | 610 SetNeedsCommit(); |
| 609 } | 611 } |
| 610 | 612 |
| 611 bool Layer::TransformIsAnimating() const { | 613 bool Layer::TransformIsAnimating() const { |
| 612 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 614 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
| 613 } | 615 } |
| 614 | 616 |
| 615 void Layer::SetScrollParent(Layer* parent) { | 617 void Layer::SetScrollParent(Layer* parent) { |
| 616 DCHECK(IsPropertyChangeAllowed()); | 618 DCHECK(IsPropertyChangeAllowed()); |
| 617 if (scroll_parent_ == parent) | 619 if (scroll_parent_ == parent) |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 layer->SetBlendMode(blend_mode_); | 915 layer->SetBlendMode(blend_mode_); |
| 914 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 916 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
| 915 layer->SetPosition(position_); | 917 layer->SetPosition(position_); |
| 916 layer->SetIsContainerForFixedPositionLayers( | 918 layer->SetIsContainerForFixedPositionLayers( |
| 917 IsContainerForFixedPositionLayers()); | 919 IsContainerForFixedPositionLayers()); |
| 918 layer->SetPositionConstraint(position_constraint_); | 920 layer->SetPositionConstraint(position_constraint_); |
| 919 layer->SetShouldFlattenTransform(should_flatten_transform_); | 921 layer->SetShouldFlattenTransform(should_flatten_transform_); |
| 920 layer->SetIs3dSorted(is_3d_sorted_); | 922 layer->SetIs3dSorted(is_3d_sorted_); |
| 921 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 923 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
| 922 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) | 924 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) |
| 923 layer->SetTransform(transform_); | 925 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
| 924 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 926 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
| 925 | 927 |
| 926 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 928 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 927 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 929 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 928 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 930 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
| 929 | 931 |
| 930 LayerImpl* scroll_parent = NULL; | 932 LayerImpl* scroll_parent = NULL; |
| 931 if (scroll_parent_) { | 933 if (scroll_parent_) { |
| 932 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 934 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
| 933 DCHECK(scroll_parent); | 935 DCHECK(scroll_parent); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 if (clip_parent_) | 1192 if (clip_parent_) |
| 1191 clip_parent_->RemoveClipChild(this); | 1193 clip_parent_->RemoveClipChild(this); |
| 1192 | 1194 |
| 1193 clip_parent_ = NULL; | 1195 clip_parent_ = NULL; |
| 1194 } | 1196 } |
| 1195 | 1197 |
| 1196 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1198 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1197 benchmark->RunOnLayer(this); | 1199 benchmark->RunOnLayer(this); |
| 1198 } | 1200 } |
| 1199 } // namespace cc | 1201 } // namespace cc |
| OLD | NEW |