| 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 needs_update_draw_properties_(true), | 81 needs_update_draw_properties_(true), |
| 82 needs_full_tree_sync_(true), | 82 needs_full_tree_sync_(true), |
| 83 next_activation_forces_redraw_(false), | 83 next_activation_forces_redraw_(false), |
| 84 has_ever_been_drawn_(false), | 84 has_ever_been_drawn_(false), |
| 85 have_scroll_event_handlers_(false), | 85 have_scroll_event_handlers_(false), |
| 86 event_listener_properties_(), | 86 event_listener_properties_(), |
| 87 browser_controls_shrink_blink_size_(false), | 87 browser_controls_shrink_blink_size_(false), |
| 88 top_controls_height_(0), | 88 top_controls_height_(0), |
| 89 bottom_controls_height_(0), | 89 bottom_controls_height_(0), |
| 90 top_controls_shown_ratio_(top_controls_shown_ratio) { | 90 top_controls_shown_ratio_(top_controls_shown_ratio) { |
| 91 if (layer_tree_host_impl_->settings().enable_color_correct_rendering) |
| 92 device_color_space_ = gfx::ColorSpace::CreateSRGB(); |
| 91 property_trees()->is_main_thread = false; | 93 property_trees()->is_main_thread = false; |
| 92 } | 94 } |
| 93 | 95 |
| 94 LayerTreeImpl::~LayerTreeImpl() { | 96 LayerTreeImpl::~LayerTreeImpl() { |
| 95 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS | 97 BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS |
| 96 : SwapPromise::ACTIVATION_FAILS); | 98 : SwapPromise::ACTIVATION_FAILS); |
| 97 | 99 |
| 98 // Need to explicitly clear the tree prior to destroying this so that | 100 // Need to explicitly clear the tree prior to destroying this so that |
| 99 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 101 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
| 100 DCHECK(LayerListIsEmpty()); | 102 DCHECK(LayerListIsEmpty()); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 set_needs_update_draw_properties(); | 867 set_needs_update_draw_properties(); |
| 866 if (IsActiveTree()) | 868 if (IsActiveTree()) |
| 867 layer_tree_host_impl_->SetFullViewportDamage(); | 869 layer_tree_host_impl_->SetFullViewportDamage(); |
| 868 layer_tree_host_impl_->SetNeedUpdateGpuRasterizationStatus(); | 870 layer_tree_host_impl_->SetNeedUpdateGpuRasterizationStatus(); |
| 869 } | 871 } |
| 870 | 872 |
| 871 void LayerTreeImpl::SetDeviceColorSpace( | 873 void LayerTreeImpl::SetDeviceColorSpace( |
| 872 const gfx::ColorSpace& device_color_space) { | 874 const gfx::ColorSpace& device_color_space) { |
| 873 if (device_color_space == device_color_space_) | 875 if (device_color_space == device_color_space_) |
| 874 return; | 876 return; |
| 877 |
| 878 // If color correct rendering is enabled, the default color space must be |
| 879 // SRGB. |
| 880 if (layer_tree_host_impl_->settings().enable_color_correct_rendering && |
| 881 device_color_space == gfx::ColorSpace()) { |
| 882 device_color_space_ = gfx::ColorSpace::CreateSRGB(); |
| 883 return; |
| 884 } |
| 885 |
| 875 device_color_space_ = device_color_space; | 886 device_color_space_ = device_color_space; |
| 876 } | 887 } |
| 877 | 888 |
| 878 SyncedProperty<ScaleGroup>* LayerTreeImpl::page_scale_factor() { | 889 SyncedProperty<ScaleGroup>* LayerTreeImpl::page_scale_factor() { |
| 879 return page_scale_factor_.get(); | 890 return page_scale_factor_.get(); |
| 880 } | 891 } |
| 881 | 892 |
| 882 const SyncedProperty<ScaleGroup>* LayerTreeImpl::page_scale_factor() const { | 893 const SyncedProperty<ScaleGroup>* LayerTreeImpl::page_scale_factor() const { |
| 883 return page_scale_factor_.get(); | 894 return page_scale_factor_.get(); |
| 884 } | 895 } |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 | 2084 |
| 2074 void LayerTreeImpl::ResetAllChangeTracking() { | 2085 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2075 layers_that_should_push_properties_.clear(); | 2086 layers_that_should_push_properties_.clear(); |
| 2076 // Iterate over all layers, including masks. | 2087 // Iterate over all layers, including masks. |
| 2077 for (auto& layer : *layers_) | 2088 for (auto& layer : *layers_) |
| 2078 layer->ResetChangeTracking(); | 2089 layer->ResetChangeTracking(); |
| 2079 property_trees_.ResetAllChangeTracking(); | 2090 property_trees_.ResetAllChangeTracking(); |
| 2080 } | 2091 } |
| 2081 | 2092 |
| 2082 } // namespace cc | 2093 } // namespace cc |
| OLD | NEW |