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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 return device_scale_factor_; | 1254 return device_scale_factor_; |
1255 } | 1255 } |
1256 | 1256 |
1257 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { | 1257 gfx::SizeF LayerTreeHostImpl::VisibleViewportSize() const { |
1258 gfx::SizeF dip_size = | 1258 gfx::SizeF dip_size = |
1259 gfx::ScaleSize(device_viewport_size(), 1.f / device_scale_factor()); | 1259 gfx::ScaleSize(device_viewport_size(), 1.f / device_scale_factor()); |
1260 | 1260 |
1261 // The clip layer should be used if non-overlay scrollbars may exist since | 1261 // The clip layer should be used if non-overlay scrollbars may exist since |
1262 // it adjusts for them. | 1262 // it adjusts for them. |
1263 LayerImpl* clip_layer = active_tree_->RootClipLayer(); | 1263 LayerImpl* clip_layer = active_tree_->RootClipLayer(); |
1264 if (!Settings().solid_color_scrollbars && clip_layer && | 1264 if (!settings().force_solid_color_scrollbars && clip_layer && |
1265 clip_layer->masks_to_bounds()) | 1265 clip_layer->masks_to_bounds()) |
1266 dip_size = clip_layer->bounds(); | 1266 dip_size = clip_layer->bounds(); |
1267 | 1267 |
1268 float top_offset = | 1268 float top_offset = |
1269 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; | 1269 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; |
1270 return gfx::SizeF(dip_size.width(), | 1270 return gfx::SizeF(dip_size.width(), |
1271 dip_size.height() - top_offset - overdraw_bottom_height_); | 1271 dip_size.height() - top_offset - overdraw_bottom_height_); |
1272 } | 1272 } |
1273 | 1273 |
1274 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { | 1274 const LayerTreeSettings& LayerTreeHostImpl::Settings() const { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 if (pending_tree_) | 1560 if (pending_tree_) |
1561 pending_tree_->set_needs_update_draw_properties(); | 1561 pending_tree_->set_needs_update_draw_properties(); |
1562 | 1562 |
1563 return true; | 1563 return true; |
1564 } | 1564 } |
1565 | 1565 |
1566 bool LayerTreeHostImpl::DeferredInitialize( | 1566 bool LayerTreeHostImpl::DeferredInitialize( |
1567 scoped_refptr<ContextProvider> offscreen_context_provider) { | 1567 scoped_refptr<ContextProvider> offscreen_context_provider) { |
1568 DCHECK(output_surface_->capabilities().deferred_gl_initialization); | 1568 DCHECK(output_surface_->capabilities().deferred_gl_initialization); |
1569 DCHECK(settings_.impl_side_painting); | 1569 DCHECK(settings_.impl_side_painting); |
1570 DCHECK(settings_.solid_color_scrollbars); | 1570 DCHECK(settings_.force_solid_color_scrollbars); |
1571 DCHECK(output_surface_->context3d()); | 1571 DCHECK(output_surface_->context3d()); |
1572 | 1572 |
1573 ReleaseTreeResources(); | 1573 ReleaseTreeResources(); |
1574 renderer_.reset(); | 1574 renderer_.reset(); |
1575 resource_provider_->Reinitialize(settings_.highp_threshold_min); | 1575 resource_provider_->Reinitialize(settings_.highp_threshold_min); |
1576 CreateAndSetRenderer(output_surface_.get(), resource_provider_.get()); | 1576 CreateAndSetRenderer(output_surface_.get(), resource_provider_.get()); |
1577 | 1577 |
1578 bool success = !!renderer_.get(); | 1578 bool success = !!renderer_.get(); |
1579 client_->DidTryInitializeRendererOnImplThread(success, | 1579 client_->DidTryInitializeRendererOnImplThread(success, |
1580 offscreen_context_provider); | 1580 offscreen_context_provider); |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 } | 2336 } |
2337 | 2337 |
2338 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2338 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2339 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2339 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2340 paint_time_counter_->ClearHistory(); | 2340 paint_time_counter_->ClearHistory(); |
2341 | 2341 |
2342 debug_state_ = debug_state; | 2342 debug_state_ = debug_state; |
2343 } | 2343 } |
2344 | 2344 |
2345 } // namespace cc | 2345 } // namespace cc |
OLD | NEW |