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