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/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 is_container_for_fixed_position_layers_(false), | 54 is_container_for_fixed_position_layers_(false), |
55 is_drawable_(false), | 55 is_drawable_(false), |
56 hide_layer_and_subtree_(false), | 56 hide_layer_and_subtree_(false), |
57 masks_to_bounds_(false), | 57 masks_to_bounds_(false), |
58 contents_opaque_(false), | 58 contents_opaque_(false), |
59 double_sided_(true), | 59 double_sided_(true), |
60 should_flatten_transform_(true), | 60 should_flatten_transform_(true), |
61 use_parent_backface_visibility_(false), | 61 use_parent_backface_visibility_(false), |
62 draw_checkerboard_for_missing_tiles_(false), | 62 draw_checkerboard_for_missing_tiles_(false), |
63 force_render_surface_(false), | 63 force_render_surface_(false), |
64 is_3d_sorted_(false), | |
65 transform_is_invertible_(true), | 64 transform_is_invertible_(true), |
66 background_color_(0), | 65 background_color_(0), |
67 opacity_(1.f), | 66 opacity_(1.f), |
68 blend_mode_(SkXfermode::kSrcOver_Mode), | 67 blend_mode_(SkXfermode::kSrcOver_Mode), |
69 scroll_parent_(NULL), | 68 scroll_parent_(NULL), |
70 clip_parent_(NULL), | 69 clip_parent_(NULL), |
71 replica_layer_(NULL), | 70 replica_layer_(NULL), |
72 raster_scale_(0.f), | 71 raster_scale_(0.f), |
73 client_(NULL) { | 72 client_(NULL) { |
74 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); | 73 layer_animation_controller_ = LayerAnimationController::Create(layer_id_); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 } | 748 } |
750 | 749 |
751 void Layer::SetDoubleSided(bool double_sided) { | 750 void Layer::SetDoubleSided(bool double_sided) { |
752 DCHECK(IsPropertyChangeAllowed()); | 751 DCHECK(IsPropertyChangeAllowed()); |
753 if (double_sided_ == double_sided) | 752 if (double_sided_ == double_sided) |
754 return; | 753 return; |
755 double_sided_ = double_sided; | 754 double_sided_ = double_sided; |
756 SetNeedsCommit(); | 755 SetNeedsCommit(); |
757 } | 756 } |
758 | 757 |
759 void Layer::SetIs3dSorted(bool sorted) { | 758 void Layer::SetContextId(int id) { |
danakj
2014/06/13 19:16:03
can you give this name a bit more "context" (ha ha
troyhildebrandt
2014/06/13 22:56:35
Done.
| |
760 DCHECK(IsPropertyChangeAllowed()); | 759 DCHECK(IsPropertyChangeAllowed()); |
761 if (is_3d_sorted_ == sorted) | 760 if ((id == 0 && context_id() == 0) || (id > 0 && context_id() > 0)) |
762 return; | 761 return; |
763 is_3d_sorted_ = sorted; | 762 draw_properties_.context_id = id; |
danakj
2014/06/13 19:16:03
If we're setting this property with a Set method o
troyhildebrandt
2014/06/13 22:56:35
Done.
| |
764 SetNeedsCommit(); | 763 SetNeedsCommit(); |
765 } | 764 } |
766 | 765 |
767 void Layer::SetShouldFlattenTransform(bool should_flatten) { | 766 void Layer::SetShouldFlattenTransform(bool should_flatten) { |
768 DCHECK(IsPropertyChangeAllowed()); | 767 DCHECK(IsPropertyChangeAllowed()); |
769 if (should_flatten_transform_ == should_flatten) | 768 if (should_flatten_transform_ == should_flatten) |
770 return; | 769 return; |
771 should_flatten_transform_ = should_flatten; | 770 should_flatten_transform_ = should_flatten; |
772 SetNeedsCommit(); | 771 SetNeedsCommit(); |
773 } | 772 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) | 886 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) |
888 layer->SetOpacity(opacity_); | 887 layer->SetOpacity(opacity_); |
889 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); | 888 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); |
890 layer->SetBlendMode(blend_mode_); | 889 layer->SetBlendMode(blend_mode_); |
891 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); | 890 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
892 layer->SetPosition(position_); | 891 layer->SetPosition(position_); |
893 layer->SetIsContainerForFixedPositionLayers( | 892 layer->SetIsContainerForFixedPositionLayers( |
894 IsContainerForFixedPositionLayers()); | 893 IsContainerForFixedPositionLayers()); |
895 layer->SetPositionConstraint(position_constraint_); | 894 layer->SetPositionConstraint(position_constraint_); |
896 layer->SetShouldFlattenTransform(should_flatten_transform_); | 895 layer->SetShouldFlattenTransform(should_flatten_transform_); |
897 layer->SetIs3dSorted(is_3d_sorted_); | 896 layer->SetContextId(context_id()); |
898 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 897 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
899 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) | 898 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) |
900 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); | 899 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); |
901 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); | 900 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); |
902 | 901 |
903 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 902 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
904 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); | 903 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); |
905 layer->set_user_scrollable_vertical(user_scrollable_vertical_); | 904 layer->set_user_scrollable_vertical(user_scrollable_vertical_); |
906 | 905 |
907 LayerImpl* scroll_parent = NULL; | 906 LayerImpl* scroll_parent = NULL; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1180 if (clip_parent_) | 1179 if (clip_parent_) |
1181 clip_parent_->RemoveClipChild(this); | 1180 clip_parent_->RemoveClipChild(this); |
1182 | 1181 |
1183 clip_parent_ = NULL; | 1182 clip_parent_ = NULL; |
1184 } | 1183 } |
1185 | 1184 |
1186 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 1185 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
1187 benchmark->RunOnLayer(this); | 1186 benchmark->RunOnLayer(this); |
1188 } | 1187 } |
1189 } // namespace cc | 1188 } // namespace cc |
OLD | NEW |