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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 return device_scale_factor_; | 1253 return device_scale_factor_; |
1254 } | 1254 } |
1255 | 1255 |
1256 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { | 1256 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { |
1257 gfx::SizeF dip_size = | 1257 gfx::SizeF dip_size = |
1258 gfx::ScaleSize(device_viewport_size(), 1.f / device_scale_factor()); | 1258 gfx::ScaleSize(device_viewport_size(), 1.f / device_scale_factor()); |
1259 | 1259 |
1260 // The clip layer should be used if non-overlay scrollbars may exist since | 1260 // The clip layer should be used if non-overlay scrollbars may exist since |
1261 // it adjusts for them. | 1261 // it adjusts for them. |
1262 LayerImpl* clip_layer = active_tree_->RootClipLayer(); | 1262 LayerImpl* clip_layer = active_tree_->RootClipLayer(); |
1263 if (!Settings().solid_color_scrollbars && clip_layer && | 1263 if (!settings().force_solid_color_scrollbars && clip_layer && |
1264 clip_layer->masks_to_bounds()) | 1264 clip_layer->masks_to_bounds()) |
1265 dip_size = clip_layer->bounds(); | 1265 dip_size = clip_layer->bounds(); |
1266 | 1266 |
1267 float top_offset = | 1267 float top_offset = |
1268 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1268 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1269 return gfx::SizeF(dip_size.width(), | 1269 return gfx::SizeF(dip_size.width(), |
1270 dip_size.height() - top_offset - overdraw_bottom_height_); | 1270 dip_size.height() - top_offset - overdraw_bottom_height_); |
1271 } | 1271 } |
1272 | 1272 |
1273 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { | 1273 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 if (pending_tree_) | 1561 if (pending_tree_) |
1562 pending_tree_->set_needs_update_draw_properties(); | 1562 pending_tree_->set_needs_update_draw_properties(); |
1563 | 1563 |
1564 return true; | 1564 return true; |
1565 } | 1565 } |
1566 | 1566 |
1567 bool LayerTreeHostImpl::DeferredInitialize( | 1567 bool LayerTreeHostImpl::DeferredInitialize( |
1568 scoped_refptr<ContextProvider> offscreen_context_provider) { | 1568 scoped_refptr<ContextProvider> offscreen_context_provider) { |
1569 DCHECK(output_surface_->capabilities().deferred_gl_initialization); | 1569 DCHECK(output_surface_->capabilities().deferred_gl_initialization); |
1570 DCHECK(settings_.impl_side_painting); | 1570 DCHECK(settings_.impl_side_painting); |
1571 DCHECK(settings_.solid_color_scrollbars); | 1571 DCHECK(settings_.force_solid_color_scrollbars); |
1572 DCHECK(output_surface_->context3d()); | 1572 DCHECK(output_surface_->context3d()); |
1573 | 1573 |
1574 ReleaseTreeResources(); | 1574 ReleaseTreeResources(); |
1575 renderer_.reset(); | 1575 renderer_.reset(); |
1576 resource_provider_->Reinitialize(settings_.highp_threshold_min); | 1576 resource_provider_->Reinitialize(settings_.highp_threshold_min); |
1577 CreateAndSetRenderer(output_surface_.get(), resource_provider_.get()); | 1577 CreateAndSetRenderer(output_surface_.get(), resource_provider_.get()); |
1578 | 1578 |
1579 bool success = !!renderer_.get(); | 1579 bool success = !!renderer_.get(); |
1580 client_->DidTryInitializeRendererOnImplThread(success, | 1580 client_->DidTryInitializeRendererOnImplThread(success, |
1581 offscreen_context_provider); | 1581 offscreen_context_provider); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 } | 2363 } |
2364 | 2364 |
2365 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2365 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2366 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2366 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2367 paint_time_counter_->ClearHistory(); | 2367 paint_time_counter_->ClearHistory(); |
2368 | 2368 |
2369 debug_state_ = debug_state; | 2369 debug_state_ = debug_state; |
2370 } | 2370 } |
2371 | 2371 |
2372 } // namespace cc | 2372 } // namespace cc |
OLD | NEW |