| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 is_drawable_(false), | 51 is_drawable_(false), |
| 52 hide_layer_and_subtree_(false), | 52 hide_layer_and_subtree_(false), |
| 53 masks_to_bounds_(false), | 53 masks_to_bounds_(false), |
| 54 contents_opaque_(false), | 54 contents_opaque_(false), |
| 55 double_sided_(true), | 55 double_sided_(true), |
| 56 should_flatten_transform_(true), | 56 should_flatten_transform_(true), |
| 57 use_parent_backface_visibility_(false), | 57 use_parent_backface_visibility_(false), |
| 58 draw_checkerboard_for_missing_tiles_(false), | 58 draw_checkerboard_for_missing_tiles_(false), |
| 59 force_render_surface_(false), | 59 force_render_surface_(false), |
| 60 is_3d_sorted_(false), | 60 is_3d_sorted_(false), |
| 61 transform_is_invertible_(true), |
| 61 anchor_point_(0.5f, 0.5f), | 62 anchor_point_(0.5f, 0.5f), |
| 62 background_color_(0), | 63 background_color_(0), |
| 63 opacity_(1.f), | 64 opacity_(1.f), |
| 64 blend_mode_(SkXfermode::kSrcOver_Mode), | 65 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 65 anchor_point_z_(0.f), | 66 anchor_point_z_(0.f), |
| 66 scroll_parent_(NULL), | 67 scroll_parent_(NULL), |
| 67 clip_parent_(NULL), | 68 clip_parent_(NULL), |
| 68 replica_layer_(NULL), | 69 replica_layer_(NULL), |
| 69 raster_scale_(0.f), | 70 raster_scale_(0.f), |
| 70 client_(NULL) { | 71 client_(NULL) { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 if (parent_ && !parent_->transform_.IsIdentityOrTranslation()) | 598 if (parent_ && !parent_->transform_.IsIdentityOrTranslation()) |
| 598 return true; | 599 return true; |
| 599 return is_container_for_fixed_position_layers_; | 600 return is_container_for_fixed_position_layers_; |
| 600 } | 601 } |
| 601 | 602 |
| 602 void Layer::SetTransform(const gfx::Transform& transform) { | 603 void Layer::SetTransform(const gfx::Transform& transform) { |
| 603 DCHECK(IsPropertyChangeAllowed()); | 604 DCHECK(IsPropertyChangeAllowed()); |
| 604 if (transform_ == transform) | 605 if (transform_ == transform) |
| 605 return; | 606 return; |
| 606 transform_ = transform; | 607 transform_ = transform; |
| 608 transform_is_invertible_ = transform.IsInvertible(); |
| 607 SetNeedsCommit(); | 609 SetNeedsCommit(); |
| 608 } | 610 } |
| 609 | 611 |
| 610 bool Layer::TransformIsAnimating() const { | 612 bool Layer::TransformIsAnimating() const { |
| 611 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 613 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
| 612 } | 614 } |
| 613 | 615 |
| 614 void Layer::SetScrollParent(Layer* parent) { | 616 void Layer::SetScrollParent(Layer* parent) { |
| 615 DCHECK(IsPropertyChangeAllowed()); | 617 DCHECK(IsPropertyChangeAllowed()); |
| 616 if (scroll_parent_ == parent) | 618 if (scroll_parent_ == parent) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 layer->SetBlendMode(blend_mode_); | 939 layer->SetBlendMode(blend_mode_); |
| 938 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 940 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
| 939 layer->SetPosition(position_); | 941 layer->SetPosition(position_); |
| 940 layer->SetIsContainerForFixedPositionLayers( | 942 layer->SetIsContainerForFixedPositionLayers( |
| 941 IsContainerForFixedPositionLayers()); | 943 IsContainerForFixedPositionLayers()); |
| 942 layer->SetPositionConstraint(position_constraint_); | 944 layer->SetPositionConstraint(position_constraint_); |
| 943 layer->SetShouldFlattenTransform(should_flatten_transform_); | 945 layer->SetShouldFlattenTransform(should_flatten_transform_); |
| 944 layer->SetIs3dSorted(is_3d_sorted_); | 946 layer->SetIs3dSorted(is_3d_sorted_); |
| 945 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 947 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
| 946 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) | 948 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) |
| 947 layer->SetTransform(transform_); | 949 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
| 948 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 950 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
| 949 | 951 |
| 950 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 952 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 951 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 953 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
| 952 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 954 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
| 953 | 955 |
| 954 LayerImpl* scroll_parent = NULL; | 956 LayerImpl* scroll_parent = NULL; |
| 955 if (scroll_parent_) { | 957 if (scroll_parent_) { |
| 956 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); | 958 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); |
| 957 DCHECK(scroll_parent); | 959 DCHECK(scroll_parent); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 if (clip_parent_) | 1216 if (clip_parent_) |
| 1215 clip_parent_->RemoveClipChild(this); | 1217 clip_parent_->RemoveClipChild(this); |
| 1216 | 1218 |
| 1217 clip_parent_ = NULL; | 1219 clip_parent_ = NULL; |
| 1218 } | 1220 } |
| 1219 | 1221 |
| 1220 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1222 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 1221 benchmark->RunOnLayer(this); | 1223 benchmark->RunOnLayer(this); |
| 1222 } | 1224 } |
| 1223 } // namespace cc | 1225 } // namespace cc |
| OLD | NEW |