| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
| 10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 493 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
| 494 layer->SetDebugName(debug_name_); | 494 layer->SetDebugName(debug_name_); |
| 495 layer->SetCompositingReasons(compositing_reasons_); | 495 layer->SetCompositingReasons(compositing_reasons_); |
| 496 layer->SetDoubleSided(double_sided_); | 496 layer->SetDoubleSided(double_sided_); |
| 497 layer->SetDrawCheckerboardForMissingTiles( | 497 layer->SetDrawCheckerboardForMissingTiles( |
| 498 draw_checkerboard_for_missing_tiles_); | 498 draw_checkerboard_for_missing_tiles_); |
| 499 layer->SetForceRenderSurface(force_render_surface_); | 499 layer->SetForceRenderSurface(force_render_surface_); |
| 500 layer->SetDrawsContent(DrawsContent()); | 500 layer->SetDrawsContent(DrawsContent()); |
| 501 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 501 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 502 layer->SetFilters(filters()); | 502 layer->SetFilters(filters()); |
| 503 layer->SetFilter(filter()); | |
| 504 layer->SetBackgroundFilters(background_filters()); | 503 layer->SetBackgroundFilters(background_filters()); |
| 505 layer->SetMasksToBounds(masks_to_bounds_); | 504 layer->SetMasksToBounds(masks_to_bounds_); |
| 506 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 505 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
| 507 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 506 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
| 508 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 507 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
| 509 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 508 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
| 510 layer->SetContentsOpaque(contents_opaque_); | 509 layer->SetContentsOpaque(contents_opaque_); |
| 511 layer->SetOpacity(opacity_); | 510 layer->SetOpacity(opacity_); |
| 512 layer->SetPosition(position_); | 511 layer->SetPosition(position_); |
| 513 layer->SetIsContainerForFixedPositionLayers( | 512 layer->SetIsContainerForFixedPositionLayers( |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 if (SkColorGetA(color) != 255) | 810 if (SkColorGetA(color) != 255) |
| 812 color = SkColorSetA(color, 255); | 811 color = SkColorSetA(color, 255); |
| 813 } | 812 } |
| 814 return color; | 813 return color; |
| 815 } | 814 } |
| 816 | 815 |
| 817 void LayerImpl::SetFilters(const FilterOperations& filters) { | 816 void LayerImpl::SetFilters(const FilterOperations& filters) { |
| 818 if (filters_ == filters) | 817 if (filters_ == filters) |
| 819 return; | 818 return; |
| 820 | 819 |
| 821 DCHECK(!filter_); | |
| 822 filters_ = filters; | 820 filters_ = filters; |
| 823 NoteLayerPropertyChangedForSubtree(); | 821 NoteLayerPropertyChangedForSubtree(); |
| 824 } | 822 } |
| 825 | 823 |
| 826 void LayerImpl::SetBackgroundFilters( | 824 void LayerImpl::SetBackgroundFilters( |
| 827 const FilterOperations& filters) { | 825 const FilterOperations& filters) { |
| 828 if (background_filters_ == filters) | 826 if (background_filters_ == filters) |
| 829 return; | 827 return; |
| 830 | 828 |
| 831 background_filters_ = filters; | 829 background_filters_ = filters; |
| 832 NoteLayerPropertyChanged(); | 830 NoteLayerPropertyChanged(); |
| 833 } | 831 } |
| 834 | 832 |
| 835 void LayerImpl::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { | |
| 836 if (filter_.get() == filter.get()) | |
| 837 return; | |
| 838 | |
| 839 DCHECK(filters_.IsEmpty()); | |
| 840 filter_ = filter; | |
| 841 NoteLayerPropertyChangedForSubtree(); | |
| 842 } | |
| 843 | |
| 844 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { | 833 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { |
| 845 if (masks_to_bounds_ == masks_to_bounds) | 834 if (masks_to_bounds_ == masks_to_bounds) |
| 846 return; | 835 return; |
| 847 | 836 |
| 848 masks_to_bounds_ = masks_to_bounds; | 837 masks_to_bounds_ = masks_to_bounds; |
| 849 NoteLayerPropertyChangedForSubtree(); | 838 NoteLayerPropertyChangedForSubtree(); |
| 850 } | 839 } |
| 851 | 840 |
| 852 void LayerImpl::SetContentsOpaque(bool opaque) { | 841 void LayerImpl::SetContentsOpaque(bool opaque) { |
| 853 if (contents_opaque_ == opaque) | 842 if (contents_opaque_ == opaque) |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 | 1308 |
| 1320 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1309 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
| 1321 | 1310 |
| 1322 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1311 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1323 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1312 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1324 AsValueInto(state.get()); | 1313 AsValueInto(state.get()); |
| 1325 return state.PassAs<base::Value>(); | 1314 return state.PassAs<base::Value>(); |
| 1326 } | 1315 } |
| 1327 | 1316 |
| 1328 } // namespace cc | 1317 } // namespace cc |
| OLD | NEW |