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_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 source_frame_number_(0), | 92 source_frame_number_(0), |
93 meta_information_sequence_number_(1), | 93 meta_information_sequence_number_(1), |
94 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 94 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
95 output_surface_lost_(true), | 95 output_surface_lost_(true), |
96 settings_(*params->settings), | 96 settings_(*params->settings), |
97 debug_state_(settings_.initial_debug_state), | 97 debug_state_(settings_.initial_debug_state), |
98 top_controls_shrink_blink_size_(false), | 98 top_controls_shrink_blink_size_(false), |
99 top_controls_height_(0.f), | 99 top_controls_height_(0.f), |
100 top_controls_shown_ratio_(0.f), | 100 top_controls_shown_ratio_(0.f), |
101 device_scale_factor_(1.f), | 101 device_scale_factor_(1.f), |
| 102 painted_device_scale_factor_(1.f), |
102 visible_(false), | 103 visible_(false), |
103 page_scale_factor_(1.f), | 104 page_scale_factor_(1.f), |
104 min_page_scale_factor_(1.f), | 105 min_page_scale_factor_(1.f), |
105 max_page_scale_factor_(1.f), | 106 max_page_scale_factor_(1.f), |
106 has_gpu_rasterization_trigger_(false), | 107 has_gpu_rasterization_trigger_(false), |
107 content_is_suitable_for_gpu_rasterization_(true), | 108 content_is_suitable_for_gpu_rasterization_(true), |
108 gpu_rasterization_histogram_recorded_(false), | 109 gpu_rasterization_histogram_recorded_(false), |
109 background_color_(SK_ColorWHITE), | 110 background_color_(SK_ColorWHITE), |
110 has_transparent_background_(false), | 111 has_transparent_background_(false), |
111 did_complete_scale_animation_(false), | 112 did_complete_scale_animation_(false), |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 305 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
305 host_impl->SetContentIsSuitableForGpuRasterization( | 306 host_impl->SetContentIsSuitableForGpuRasterization( |
306 content_is_suitable_for_gpu_rasterization_); | 307 content_is_suitable_for_gpu_rasterization_); |
307 RecordGpuRasterizationHistogram(); | 308 RecordGpuRasterizationHistogram(); |
308 | 309 |
309 host_impl->SetViewportSize(device_viewport_size_); | 310 host_impl->SetViewportSize(device_viewport_size_); |
310 // TODO(senorblanco): Move this up so that it happens before GPU rasterization | 311 // TODO(senorblanco): Move this up so that it happens before GPU rasterization |
311 // properties are set, since those trigger an update of GPU rasterization | 312 // properties are set, since those trigger an update of GPU rasterization |
312 // status, which depends on the device scale factor. (crbug.com/535700) | 313 // status, which depends on the device scale factor. (crbug.com/535700) |
313 sync_tree->SetDeviceScaleFactor(device_scale_factor_); | 314 sync_tree->SetDeviceScaleFactor(device_scale_factor_); |
| 315 sync_tree->set_painted_device_scale_factor(painted_device_scale_factor_); |
314 host_impl->SetDebugState(debug_state_); | 316 host_impl->SetDebugState(debug_state_); |
315 if (pending_page_scale_animation_) { | 317 if (pending_page_scale_animation_) { |
316 sync_tree->SetPendingPageScaleAnimation( | 318 sync_tree->SetPendingPageScaleAnimation( |
317 pending_page_scale_animation_.Pass()); | 319 pending_page_scale_animation_.Pass()); |
318 } | 320 } |
319 | 321 |
320 if (!ui_resource_request_queue_.empty()) { | 322 if (!ui_resource_request_queue_.empty()) { |
321 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); | 323 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); |
322 ui_resource_request_queue_.clear(); | 324 ui_resource_request_queue_.clear(); |
323 } | 325 } |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 866 |
865 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { | 867 void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { |
866 if (device_scale_factor == device_scale_factor_) | 868 if (device_scale_factor == device_scale_factor_) |
867 return; | 869 return; |
868 device_scale_factor_ = device_scale_factor; | 870 device_scale_factor_ = device_scale_factor; |
869 | 871 |
870 property_trees_.needs_rebuild = true; | 872 property_trees_.needs_rebuild = true; |
871 SetNeedsCommit(); | 873 SetNeedsCommit(); |
872 } | 874 } |
873 | 875 |
| 876 void LayerTreeHost::SetPaintedDeviceScaleFactor( |
| 877 float painted_device_scale_factor) { |
| 878 if (painted_device_scale_factor == painted_device_scale_factor_) |
| 879 return; |
| 880 painted_device_scale_factor_ = painted_device_scale_factor; |
| 881 |
| 882 SetNeedsCommit(); |
| 883 } |
| 884 |
874 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, | 885 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, |
875 TopControlsState current, | 886 TopControlsState current, |
876 bool animate) { | 887 bool animate) { |
877 // Top controls are only used in threaded mode. | 888 // Top controls are only used in threaded mode. |
878 DCHECK(proxy_->HasImplThread()); | 889 DCHECK(proxy_->HasImplThread()); |
879 proxy_->UpdateTopControlsState(constraints, current, animate); | 890 proxy_->UpdateTopControlsState(constraints, current, animate); |
880 } | 891 } |
881 | 892 |
882 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { | 893 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { |
883 if (!settings_.accelerated_animation_enabled) | 894 if (!settings_.accelerated_animation_enabled) |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) | 1231 return animation_host_ ? animation_host_->HasAnyAnimation(layer->id()) |
1221 : false; | 1232 : false; |
1222 } | 1233 } |
1223 | 1234 |
1224 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { | 1235 bool LayerTreeHost::HasActiveAnimation(const Layer* layer) const { |
1225 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) | 1236 return animation_host_ ? animation_host_->HasActiveAnimation(layer->id()) |
1226 : false; | 1237 : false; |
1227 } | 1238 } |
1228 | 1239 |
1229 } // namespace cc | 1240 } // namespace cc |
OLD | NEW |