| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 is_drawable_(false), | 70 is_drawable_(false), |
| 71 draws_content_(false), | 71 draws_content_(false), |
| 72 hide_layer_and_subtree_(false), | 72 hide_layer_and_subtree_(false), |
| 73 masks_to_bounds_(false), | 73 masks_to_bounds_(false), |
| 74 contents_opaque_(false), | 74 contents_opaque_(false), |
| 75 double_sided_(true), | 75 double_sided_(true), |
| 76 should_flatten_transform_(true), | 76 should_flatten_transform_(true), |
| 77 use_parent_backface_visibility_(false), | 77 use_parent_backface_visibility_(false), |
| 78 use_local_transform_for_backface_visibility_(false), | 78 use_local_transform_for_backface_visibility_(false), |
| 79 should_check_backface_visibility_(false), | 79 should_check_backface_visibility_(false), |
| 80 force_render_surface_(false), | 80 force_render_surface_for_testing_(false), |
| 81 transform_is_invertible_(true), | 81 transform_is_invertible_(true), |
| 82 has_render_surface_(false), | 82 has_render_surface_(false), |
| 83 subtree_property_changed_(false), | 83 subtree_property_changed_(false), |
| 84 background_color_(0), | 84 background_color_(0), |
| 85 safe_opaque_background_color_(0), | 85 safe_opaque_background_color_(0), |
| 86 opacity_(1.f), | 86 opacity_(1.f), |
| 87 blend_mode_(SkXfermode::kSrcOver_Mode), | 87 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 88 draw_blend_mode_(SkXfermode::kSrcOver_Mode), | 88 draw_blend_mode_(SkXfermode::kSrcOver_Mode), |
| 89 scroll_parent_(nullptr), | 89 scroll_parent_(nullptr), |
| 90 clip_parent_(nullptr), | 90 clip_parent_(nullptr), |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 | 895 |
| 896 void Layer::SetTouchEventHandlerRegion(const Region& region) { | 896 void Layer::SetTouchEventHandlerRegion(const Region& region) { |
| 897 DCHECK(IsPropertyChangeAllowed()); | 897 DCHECK(IsPropertyChangeAllowed()); |
| 898 if (touch_event_handler_region_ == region) | 898 if (touch_event_handler_region_ == region) |
| 899 return; | 899 return; |
| 900 | 900 |
| 901 touch_event_handler_region_ = region; | 901 touch_event_handler_region_ = region; |
| 902 SetNeedsCommit(); | 902 SetNeedsCommit(); |
| 903 } | 903 } |
| 904 | 904 |
| 905 void Layer::SetForceRenderSurface(bool force) { | 905 void Layer::SetForceRenderSurfaceForTesting(bool force) { |
| 906 DCHECK(IsPropertyChangeAllowed()); | 906 DCHECK(IsPropertyChangeAllowed()); |
| 907 if (force_render_surface_ == force) | 907 if (force_render_surface_for_testing_ == force) |
| 908 return; | 908 return; |
| 909 force_render_surface_ = force; | 909 force_render_surface_for_testing_ = force; |
| 910 SetNeedsCommit(); | 910 SetNeedsCommit(); |
| 911 } | 911 } |
| 912 | 912 |
| 913 void Layer::SetDoubleSided(bool double_sided) { | 913 void Layer::SetDoubleSided(bool double_sided) { |
| 914 DCHECK(IsPropertyChangeAllowed()); | 914 DCHECK(IsPropertyChangeAllowed()); |
| 915 if (double_sided_ == double_sided) | 915 if (double_sided_ == double_sided) |
| 916 return; | 916 return; |
| 917 double_sided_ = double_sided; | 917 double_sided_ = double_sided; |
| 918 SetNeedsCommit(); | 918 SetNeedsCommit(); |
| 919 SetSubtreePropertyChanged(); | 919 SetSubtreePropertyChanged(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 layer->SetDebugInfo(TakeDebugInfo()); | 1130 layer->SetDebugInfo(TakeDebugInfo()); |
| 1131 #else | 1131 #else |
| 1132 layer->SetDebugInfo(TakeDebugInfo()); | 1132 layer->SetDebugInfo(TakeDebugInfo()); |
| 1133 #endif | 1133 #endif |
| 1134 | 1134 |
| 1135 layer->SetTransformTreeIndex(transform_tree_index()); | 1135 layer->SetTransformTreeIndex(transform_tree_index()); |
| 1136 layer->SetEffectTreeIndex(effect_tree_index()); | 1136 layer->SetEffectTreeIndex(effect_tree_index()); |
| 1137 layer->SetClipTreeIndex(clip_tree_index()); | 1137 layer->SetClipTreeIndex(clip_tree_index()); |
| 1138 layer->SetScrollTreeIndex(scroll_tree_index()); | 1138 layer->SetScrollTreeIndex(scroll_tree_index()); |
| 1139 layer->set_offset_to_transform_parent(offset_to_transform_parent_); | 1139 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
| 1140 layer->SetDoubleSided(double_sided_); | |
| 1141 layer->SetDrawsContent(DrawsContent()); | 1140 layer->SetDrawsContent(DrawsContent()); |
| 1142 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 1141 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 1143 layer->SetHasRenderSurface(has_render_surface_); | 1142 layer->SetHasRenderSurface(has_render_surface_); |
| 1144 // subtree_property_changed_ is propagated to all descendants while building | 1143 // subtree_property_changed_ is propagated to all descendants while building |
| 1145 // property trees. So, it is enough to check it only for the current layer. | 1144 // property trees. So, it is enough to check it only for the current layer. |
| 1146 if (subtree_property_changed_) | 1145 if (subtree_property_changed_) |
| 1147 layer->NoteLayerPropertyChanged(); | 1146 layer->NoteLayerPropertyChanged(); |
| 1148 layer->SetForceRenderSurface(force_render_surface_); | |
| 1149 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) | 1147 if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating()) |
| 1150 layer->SetFilters(filters_); | 1148 layer->SetFilters(filters_); |
| 1151 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); | 1149 DCHECK(!(FilterIsAnimating() && layer->FilterIsAnimatingOnImplOnly())); |
| 1152 layer->SetBackgroundFilters(background_filters()); | 1150 layer->SetBackgroundFilters(background_filters()); |
| 1153 layer->SetMasksToBounds(masks_to_bounds_); | 1151 layer->SetMasksToBounds(masks_to_bounds_); |
| 1154 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); | 1152 layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_); |
| 1155 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 1153 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
| 1156 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 1154 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
| 1157 layer->SetContentsOpaque(contents_opaque_); | 1155 layer->SetContentsOpaque(contents_opaque_); |
| 1158 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) | 1156 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1819 ->data.num_copy_requests_in_subtree; | 1817 ->data.num_copy_requests_in_subtree; |
| 1820 } | 1818 } |
| 1821 | 1819 |
| 1822 gfx::Transform Layer::screen_space_transform() const { | 1820 gfx::Transform Layer::screen_space_transform() const { |
| 1823 DCHECK_NE(transform_tree_index_, -1); | 1821 DCHECK_NE(transform_tree_index_, -1); |
| 1824 return draw_property_utils::ScreenSpaceTransform( | 1822 return draw_property_utils::ScreenSpaceTransform( |
| 1825 this, layer_tree_host_->property_trees()->transform_tree); | 1823 this, layer_tree_host_->property_trees()->transform_tree); |
| 1826 } | 1824 } |
| 1827 | 1825 |
| 1828 } // namespace cc | 1826 } // namespace cc |
| OLD | NEW |