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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 if (pending_tree_) | 1562 if (pending_tree_) |
1563 pending_tree_->set_needs_update_draw_properties(); | 1563 pending_tree_->set_needs_update_draw_properties(); |
1564 | 1564 |
1565 return true; | 1565 return true; |
1566 } | 1566 } |
1567 | 1567 |
1568 bool LayerTreeHostImpl::DeferredInitialize( | 1568 bool LayerTreeHostImpl::DeferredInitialize( |
1569 scoped_refptr<ContextProvider> offscreen_context_provider) { | 1569 scoped_refptr<ContextProvider> offscreen_context_provider) { |
1570 DCHECK(output_surface_->capabilities().deferred_gl_initialization); | 1570 DCHECK(output_surface_->capabilities().deferred_gl_initialization); |
1571 DCHECK(settings_.impl_side_painting); | 1571 DCHECK(settings_.impl_side_painting); |
1572 DCHECK(settings_.solid_color_scrollbars); | 1572 DCHECK(settings_.force_solid_color_scrollbars); |
1573 DCHECK(output_surface_->context3d()); | 1573 DCHECK(output_surface_->context3d()); |
1574 | 1574 |
1575 ReleaseTreeResources(); | 1575 ReleaseTreeResources(); |
1576 renderer_.reset(); | 1576 renderer_.reset(); |
1577 resource_provider_->Reinitialize(settings_.highp_threshold_min); | 1577 resource_provider_->Reinitialize(settings_.highp_threshold_min); |
1578 CreateAndSetRenderer(output_surface_.get(), resource_provider_.get()); | 1578 CreateAndSetRenderer(output_surface_.get(), resource_provider_.get()); |
1579 | 1579 |
1580 bool success = !!renderer_.get(); | 1580 bool success = !!renderer_.get(); |
1581 client_->DidTryInitializeRendererOnImplThread(success, | 1581 client_->DidTryInitializeRendererOnImplThread(success, |
1582 offscreen_context_provider); | 1582 offscreen_context_provider); |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 } | 2344 } |
2345 | 2345 |
2346 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 2346 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
2347 if (debug_state_.continuous_painting != debug_state.continuous_painting) | 2347 if (debug_state_.continuous_painting != debug_state.continuous_painting) |
2348 paint_time_counter_->ClearHistory(); | 2348 paint_time_counter_->ClearHistory(); |
2349 | 2349 |
2350 debug_state_ = debug_state; | 2350 debug_state_ = debug_state; |
2351 } | 2351 } |
2352 | 2352 |
2353 } // namespace cc | 2353 } // namespace cc |
OLD | NEW |