| 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 <utility> | 10 #include <utility> |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 return result; | 771 return result; |
| 772 } | 772 } |
| 773 | 773 |
| 774 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) { | 774 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) { |
| 775 if (stacking_order_changed) { | 775 if (stacking_order_changed) { |
| 776 stacking_order_changed_ = true; | 776 stacking_order_changed_ = true; |
| 777 NoteLayerPropertyChangedForSubtree(); | 777 NoteLayerPropertyChangedForSubtree(); |
| 778 } | 778 } |
| 779 } | 779 } |
| 780 | 780 |
| 781 bool LayerImpl::LayerPropertyChanged() const { |
| 782 if (layer_property_changed_) |
| 783 return true; |
| 784 TransformNode* node = |
| 785 layer_tree_impl()->property_trees()->transform_tree.Node( |
| 786 transform_tree_index()); |
| 787 if (node && node->data.transform_changed) |
| 788 return true; |
| 789 return false; |
| 790 } |
| 791 |
| 781 void LayerImpl::NoteLayerPropertyChanged() { | 792 void LayerImpl::NoteLayerPropertyChanged() { |
| 782 layer_property_changed_ = true; | 793 layer_property_changed_ = true; |
| 783 layer_tree_impl()->set_needs_update_draw_properties(); | 794 layer_tree_impl()->set_needs_update_draw_properties(); |
| 784 SetNeedsPushProperties(); | 795 SetNeedsPushProperties(); |
| 785 } | 796 } |
| 786 | 797 |
| 787 void LayerImpl::NoteLayerPropertyChangedForSubtree() { | 798 void LayerImpl::NoteLayerPropertyChangedForSubtree() { |
| 788 layer_property_changed_ = true; | 799 layer_property_changed_ = true; |
| 789 layer_tree_impl()->set_needs_update_draw_properties(); | 800 layer_tree_impl()->set_needs_update_draw_properties(); |
| 790 for (size_t i = 0; i < children_.size(); ++i) | 801 for (size_t i = 0; i < children_.size(); ++i) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 813 resource_provider->ValidateResource(resource_id); | 824 resource_provider->ValidateResource(resource_id); |
| 814 #endif | 825 #endif |
| 815 } | 826 } |
| 816 | 827 |
| 817 const char* LayerImpl::LayerTypeAsString() const { | 828 const char* LayerImpl::LayerTypeAsString() const { |
| 818 return "cc::LayerImpl"; | 829 return "cc::LayerImpl"; |
| 819 } | 830 } |
| 820 | 831 |
| 821 void LayerImpl::ResetAllChangeTrackingForSubtree() { | 832 void LayerImpl::ResetAllChangeTrackingForSubtree() { |
| 822 layer_property_changed_ = false; | 833 layer_property_changed_ = false; |
| 834 if (TransformNode* transform_node = |
| 835 layer_tree_impl_->property_trees()->transform_tree.Node( |
| 836 transform_tree_index())) { |
| 837 transform_node->data.transform_changed = false; |
| 838 } |
| 823 | 839 |
| 824 update_rect_.SetRect(0, 0, 0, 0); | 840 update_rect_.SetRect(0, 0, 0, 0); |
| 825 damage_rect_.SetRect(0, 0, 0, 0); | 841 damage_rect_.SetRect(0, 0, 0, 0); |
| 826 | 842 |
| 827 if (render_surface_) | 843 if (render_surface_) |
| 828 render_surface_->ResetPropertyChangedFlag(); | 844 render_surface_->ResetPropertyChangedFlag(); |
| 829 | 845 |
| 830 if (mask_layer_) | 846 if (mask_layer_) |
| 831 mask_layer_->ResetAllChangeTrackingForSubtree(); | 847 mask_layer_->ResetAllChangeTrackingForSubtree(); |
| 832 | 848 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } | 1024 } |
| 1009 | 1025 |
| 1010 void LayerImpl::SetBounds(const gfx::Size& bounds) { | 1026 void LayerImpl::SetBounds(const gfx::Size& bounds) { |
| 1011 if (bounds_ == bounds) | 1027 if (bounds_ == bounds) |
| 1012 return; | 1028 return; |
| 1013 | 1029 |
| 1014 bounds_ = bounds; | 1030 bounds_ = bounds; |
| 1015 | 1031 |
| 1016 layer_tree_impl()->DidUpdateScrollState(id()); | 1032 layer_tree_impl()->DidUpdateScrollState(id()); |
| 1017 | 1033 |
| 1018 if (masks_to_bounds()) | 1034 if (!masks_to_bounds()) |
| 1019 NoteLayerPropertyChangedForSubtree(); | |
| 1020 else | |
| 1021 NoteLayerPropertyChanged(); | 1035 NoteLayerPropertyChanged(); |
| 1022 } | 1036 } |
| 1023 | 1037 |
| 1024 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { | 1038 void LayerImpl::SetBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
| 1025 DCHECK(IsActive()); | 1039 DCHECK(IsActive()); |
| 1026 if (bounds_delta_ == bounds_delta) | 1040 if (bounds_delta_ == bounds_delta) |
| 1027 return; | 1041 return; |
| 1028 | 1042 |
| 1029 bounds_delta_ = bounds_delta; | 1043 bounds_delta_ = bounds_delta; |
| 1030 | 1044 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 if (hide_layer_and_subtree_ == hide) | 1126 if (hide_layer_and_subtree_ == hide) |
| 1113 return; | 1127 return; |
| 1114 | 1128 |
| 1115 hide_layer_and_subtree_ = hide; | 1129 hide_layer_and_subtree_ = hide; |
| 1116 } | 1130 } |
| 1117 | 1131 |
| 1118 void LayerImpl::SetTransformOrigin(const gfx::Point3F& transform_origin) { | 1132 void LayerImpl::SetTransformOrigin(const gfx::Point3F& transform_origin) { |
| 1119 if (transform_origin_ == transform_origin) | 1133 if (transform_origin_ == transform_origin) |
| 1120 return; | 1134 return; |
| 1121 transform_origin_ = transform_origin; | 1135 transform_origin_ = transform_origin; |
| 1122 NoteLayerPropertyChangedForSubtree(); | |
| 1123 } | 1136 } |
| 1124 | 1137 |
| 1125 void LayerImpl::SetBackgroundColor(SkColor background_color) { | 1138 void LayerImpl::SetBackgroundColor(SkColor background_color) { |
| 1126 if (background_color_ == background_color) | 1139 if (background_color_ == background_color) |
| 1127 return; | 1140 return; |
| 1128 | 1141 |
| 1129 background_color_ = background_color; | 1142 background_color_ = background_color; |
| 1130 NoteLayerPropertyChanged(); | 1143 NoteLayerPropertyChanged(); |
| 1131 } | 1144 } |
| 1132 | 1145 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 | 1302 |
| 1290 is_root_for_isolated_group_ = root; | 1303 is_root_for_isolated_group_ = root; |
| 1291 SetNeedsPushProperties(); | 1304 SetNeedsPushProperties(); |
| 1292 } | 1305 } |
| 1293 | 1306 |
| 1294 void LayerImpl::SetPosition(const gfx::PointF& position) { | 1307 void LayerImpl::SetPosition(const gfx::PointF& position) { |
| 1295 if (position_ == position) | 1308 if (position_ == position) |
| 1296 return; | 1309 return; |
| 1297 | 1310 |
| 1298 position_ = position; | 1311 position_ = position; |
| 1299 NoteLayerPropertyChangedForSubtree(); | |
| 1300 } | 1312 } |
| 1301 | 1313 |
| 1302 void LayerImpl::SetShouldFlattenTransform(bool flatten) { | 1314 void LayerImpl::SetShouldFlattenTransform(bool flatten) { |
| 1303 if (should_flatten_transform_ == flatten) | 1315 if (should_flatten_transform_ == flatten) |
| 1304 return; | 1316 return; |
| 1305 | 1317 |
| 1306 should_flatten_transform_ = flatten; | 1318 should_flatten_transform_ = flatten; |
| 1307 } | 1319 } |
| 1308 | 1320 |
| 1309 void LayerImpl::Set3dSortingContextId(int id) { | 1321 void LayerImpl::Set3dSortingContextId(int id) { |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 .layer_transforms_should_scale_layer_contents) { | 1883 .layer_transforms_should_scale_layer_contents) { |
| 1872 return default_scale; | 1884 return default_scale; |
| 1873 } | 1885 } |
| 1874 | 1886 |
| 1875 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1887 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1876 DrawTransform(), default_scale); | 1888 DrawTransform(), default_scale); |
| 1877 return std::max(transform_scales.x(), transform_scales.y()); | 1889 return std::max(transform_scales.x(), transform_scales.y()); |
| 1878 } | 1890 } |
| 1879 | 1891 |
| 1880 } // namespace cc | 1892 } // namespace cc |
| OLD | NEW |