| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (host) { | 116 if (host) { |
| 117 layer_animation_controller_->SetAnimationRegistrar( | 117 layer_animation_controller_->SetAnimationRegistrar( |
| 118 host->animation_registrar()); | 118 host->animation_registrar()); |
| 119 | 119 |
| 120 if (host->settings().layer_transforms_should_scale_layer_contents) | 120 if (host->settings().layer_transforms_should_scale_layer_contents) |
| 121 reset_raster_scale_to_unknown(); | 121 reset_raster_scale_to_unknown(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 if (host && layer_animation_controller_->has_any_animation()) | 124 if (host && layer_animation_controller_->has_any_animation()) |
| 125 host->SetNeedsCommit(); | 125 host->SetNeedsCommit(); |
| 126 if (host && | 126 if (host && (!filters_.IsEmpty() || !background_filters_.IsEmpty())) |
| 127 (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_)) | |
| 128 layer_tree_host_->set_needs_filter_context(); | 127 layer_tree_host_->set_needs_filter_context(); |
| 129 } | 128 } |
| 130 | 129 |
| 131 void Layer::SetNeedsUpdate() { | 130 void Layer::SetNeedsUpdate() { |
| 132 if (layer_tree_host_ && !ignore_set_needs_commit_) | 131 if (layer_tree_host_ && !ignore_set_needs_commit_) |
| 133 layer_tree_host_->SetNeedsUpdateLayers(); | 132 layer_tree_host_->SetNeedsUpdateLayers(); |
| 134 } | 133 } |
| 135 | 134 |
| 136 void Layer::SetNeedsCommit() { | 135 void Layer::SetNeedsCommit() { |
| 137 if (!layer_tree_host_) | 136 if (!layer_tree_host_) |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 replica_layer_->RemoveFromParent(); | 464 replica_layer_->RemoveFromParent(); |
| 466 replica_layer_->SetParent(this); | 465 replica_layer_->SetParent(this); |
| 467 } | 466 } |
| 468 SetNeedsFullTreeSync(); | 467 SetNeedsFullTreeSync(); |
| 469 } | 468 } |
| 470 | 469 |
| 471 void Layer::SetFilters(const FilterOperations& filters) { | 470 void Layer::SetFilters(const FilterOperations& filters) { |
| 472 DCHECK(IsPropertyChangeAllowed()); | 471 DCHECK(IsPropertyChangeAllowed()); |
| 473 if (filters_ == filters) | 472 if (filters_ == filters) |
| 474 return; | 473 return; |
| 475 DCHECK(!filter_); | |
| 476 filters_ = filters; | 474 filters_ = filters; |
| 477 SetNeedsCommit(); | 475 SetNeedsCommit(); |
| 478 if (!filters.IsEmpty() && layer_tree_host_) | 476 if (!filters.IsEmpty() && layer_tree_host_) |
| 479 layer_tree_host_->set_needs_filter_context(); | 477 layer_tree_host_->set_needs_filter_context(); |
| 480 } | 478 } |
| 481 | 479 |
| 482 void Layer::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { | |
| 483 DCHECK(IsPropertyChangeAllowed()); | |
| 484 if (filter_.get() == filter.get()) | |
| 485 return; | |
| 486 DCHECK(filters_.IsEmpty()); | |
| 487 filter_ = filter; | |
| 488 SetNeedsCommit(); | |
| 489 if (filter && layer_tree_host_) | |
| 490 layer_tree_host_->set_needs_filter_context(); | |
| 491 } | |
| 492 | |
| 493 void Layer::SetBackgroundFilters(const FilterOperations& filters) { | 480 void Layer::SetBackgroundFilters(const FilterOperations& filters) { |
| 494 DCHECK(IsPropertyChangeAllowed()); | 481 DCHECK(IsPropertyChangeAllowed()); |
| 495 if (background_filters_ == filters) | 482 if (background_filters_ == filters) |
| 496 return; | 483 return; |
| 497 background_filters_ = filters; | 484 background_filters_ = filters; |
| 498 SetNeedsCommit(); | 485 SetNeedsCommit(); |
| 499 if (!filters.IsEmpty() && layer_tree_host_) | 486 if (!filters.IsEmpty() && layer_tree_host_) |
| 500 layer_tree_host_->set_needs_filter_context(); | 487 layer_tree_host_->set_needs_filter_context(); |
| 501 } | 488 } |
| 502 | 489 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 layer->SetDebugName(std::string()); | 801 layer->SetDebugName(std::string()); |
| 815 | 802 |
| 816 layer->SetCompositingReasons(compositing_reasons_); | 803 layer->SetCompositingReasons(compositing_reasons_); |
| 817 layer->SetDoubleSided(double_sided_); | 804 layer->SetDoubleSided(double_sided_); |
| 818 layer->SetDrawCheckerboardForMissingTiles( | 805 layer->SetDrawCheckerboardForMissingTiles( |
| 819 draw_checkerboard_for_missing_tiles_); | 806 draw_checkerboard_for_missing_tiles_); |
| 820 layer->SetForceRenderSurface(force_render_surface_); | 807 layer->SetForceRenderSurface(force_render_surface_); |
| 821 layer->SetDrawsContent(DrawsContent()); | 808 layer->SetDrawsContent(DrawsContent()); |
| 822 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 809 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 823 layer->SetFilters(filters()); | 810 layer->SetFilters(filters()); |
| 824 layer->SetFilter(filter()); | |
| 825 layer->SetBackgroundFilters(background_filters()); | 811 layer->SetBackgroundFilters(background_filters()); |
| 826 layer->SetMasksToBounds(masks_to_bounds_); | 812 layer->SetMasksToBounds(masks_to_bounds_); |
| 827 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 813 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
| 828 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 814 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
| 829 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 815 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
| 830 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 816 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
| 831 layer->SetContentsOpaque(contents_opaque_); | 817 layer->SetContentsOpaque(contents_opaque_); |
| 832 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) | 818 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) |
| 833 layer->SetOpacity(opacity_); | 819 layer->SetOpacity(opacity_); |
| 834 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); | 820 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 (*it)->clip_parent_ = NULL; | 1078 (*it)->clip_parent_ = NULL; |
| 1093 } | 1079 } |
| 1094 | 1080 |
| 1095 if (clip_parent_) | 1081 if (clip_parent_) |
| 1096 clip_parent_->RemoveClipChild(this); | 1082 clip_parent_->RemoveClipChild(this); |
| 1097 | 1083 |
| 1098 clip_parent_ = NULL; | 1084 clip_parent_ = NULL; |
| 1099 } | 1085 } |
| 1100 | 1086 |
| 1101 } // namespace cc | 1087 } // namespace cc |
| OLD | NEW |