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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 492 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
493 layer->SetDebugName(debug_name_); | 493 layer->SetDebugName(debug_name_); |
494 layer->SetCompositingReasons(compositing_reasons_); | 494 layer->SetCompositingReasons(compositing_reasons_); |
495 layer->SetDoubleSided(double_sided_); | 495 layer->SetDoubleSided(double_sided_); |
496 layer->SetDrawCheckerboardForMissingTiles( | 496 layer->SetDrawCheckerboardForMissingTiles( |
497 draw_checkerboard_for_missing_tiles_); | 497 draw_checkerboard_for_missing_tiles_); |
498 layer->SetForceRenderSurface(force_render_surface_); | 498 layer->SetForceRenderSurface(force_render_surface_); |
499 layer->SetDrawsContent(DrawsContent()); | 499 layer->SetDrawsContent(DrawsContent()); |
500 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 500 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
501 layer->SetFilters(filters()); | 501 layer->SetFilters(filters()); |
502 layer->SetFilter(filter()); | |
503 layer->SetBackgroundFilters(background_filters()); | 502 layer->SetBackgroundFilters(background_filters()); |
504 layer->SetMasksToBounds(masks_to_bounds_); | 503 layer->SetMasksToBounds(masks_to_bounds_); |
505 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 504 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
506 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 505 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
507 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 506 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
508 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 507 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
509 layer->SetContentsOpaque(contents_opaque_); | 508 layer->SetContentsOpaque(contents_opaque_); |
510 layer->SetOpacity(opacity_); | 509 layer->SetOpacity(opacity_); |
511 layer->SetPosition(position_); | 510 layer->SetPosition(position_); |
512 layer->SetIsContainerForFixedPositionLayers( | 511 layer->SetIsContainerForFixedPositionLayers( |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 if (SkColorGetA(color) != 255) | 809 if (SkColorGetA(color) != 255) |
811 color = SkColorSetA(color, 255); | 810 color = SkColorSetA(color, 255); |
812 } | 811 } |
813 return color; | 812 return color; |
814 } | 813 } |
815 | 814 |
816 void LayerImpl::SetFilters(const FilterOperations& filters) { | 815 void LayerImpl::SetFilters(const FilterOperations& filters) { |
817 if (filters_ == filters) | 816 if (filters_ == filters) |
818 return; | 817 return; |
819 | 818 |
820 DCHECK(!filter_); | |
821 filters_ = filters; | 819 filters_ = filters; |
822 NoteLayerPropertyChangedForSubtree(); | 820 NoteLayerPropertyChangedForSubtree(); |
823 } | 821 } |
824 | 822 |
825 void LayerImpl::SetBackgroundFilters( | 823 void LayerImpl::SetBackgroundFilters( |
826 const FilterOperations& filters) { | 824 const FilterOperations& filters) { |
827 if (background_filters_ == filters) | 825 if (background_filters_ == filters) |
828 return; | 826 return; |
829 | 827 |
830 background_filters_ = filters; | 828 background_filters_ = filters; |
831 NoteLayerPropertyChanged(); | 829 NoteLayerPropertyChanged(); |
832 } | 830 } |
833 | 831 |
834 void LayerImpl::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { | |
835 if (filter_.get() == filter.get()) | |
836 return; | |
837 | |
838 DCHECK(filters_.IsEmpty()); | |
839 filter_ = filter; | |
840 NoteLayerPropertyChangedForSubtree(); | |
841 } | |
842 | |
843 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { | 832 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { |
844 if (masks_to_bounds_ == masks_to_bounds) | 833 if (masks_to_bounds_ == masks_to_bounds) |
845 return; | 834 return; |
846 | 835 |
847 masks_to_bounds_ = masks_to_bounds; | 836 masks_to_bounds_ = masks_to_bounds; |
848 NoteLayerPropertyChangedForSubtree(); | 837 NoteLayerPropertyChangedForSubtree(); |
849 } | 838 } |
850 | 839 |
851 void LayerImpl::SetContentsOpaque(bool opaque) { | 840 void LayerImpl::SetContentsOpaque(bool opaque) { |
852 if (contents_opaque_ == opaque) | 841 if (contents_opaque_ == opaque) |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 | 1296 |
1308 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1297 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1309 | 1298 |
1310 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1299 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1311 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1300 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1312 AsValueInto(state.get()); | 1301 AsValueInto(state.get()); |
1313 return state.PassAs<base::Value>(); | 1302 return state.PassAs<base::Value>(); |
1314 } | 1303 } |
1315 | 1304 |
1316 } // namespace cc | 1305 } // namespace cc |
OLD | NEW |