Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 #include "cc/trees/latency_info_swap_promise_monitor.h" | 82 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 83 #include "cc/trees/layer_tree_host.h" | 83 #include "cc/trees/layer_tree_host.h" |
| 84 #include "cc/trees/layer_tree_host_common.h" | 84 #include "cc/trees/layer_tree_host_common.h" |
| 85 #include "cc/trees/layer_tree_impl.h" | 85 #include "cc/trees/layer_tree_impl.h" |
| 86 #include "cc/trees/single_thread_proxy.h" | 86 #include "cc/trees/single_thread_proxy.h" |
| 87 #include "cc/trees/tree_synchronizer.h" | 87 #include "cc/trees/tree_synchronizer.h" |
| 88 #include "gpu/GLES2/gl2extchromium.h" | 88 #include "gpu/GLES2/gl2extchromium.h" |
| 89 #include "gpu/command_buffer/client/gles2_interface.h" | 89 #include "gpu/command_buffer/client/gles2_interface.h" |
| 90 #include "ui/gfx/geometry/point_conversions.h" | 90 #include "ui/gfx/geometry/point_conversions.h" |
| 91 #include "ui/gfx/geometry/rect_conversions.h" | 91 #include "ui/gfx/geometry/rect_conversions.h" |
| 92 #include "ui/gfx/geometry/safe_integer_conversions.h" | |
| 92 #include "ui/gfx/geometry/scroll_offset.h" | 93 #include "ui/gfx/geometry/scroll_offset.h" |
| 93 #include "ui/gfx/geometry/size_conversions.h" | 94 #include "ui/gfx/geometry/size_conversions.h" |
| 94 #include "ui/gfx/geometry/vector2d_conversions.h" | 95 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 95 | 96 |
| 96 namespace cc { | 97 namespace cc { |
| 97 namespace { | 98 namespace { |
| 98 | 99 |
| 99 // Small helper class that saves the current viewport location as the user sees | 100 // Small helper class that saves the current viewport location as the user sees |
| 100 // it and resets to the same location. | 101 // it and resets to the same location. |
| 101 class ViewportAnchor { | 102 class ViewportAnchor { |
| (...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2401 active_tree_->SetViewportSizeInvalid(); | 2402 active_tree_->SetViewportSizeInvalid(); |
| 2402 | 2403 |
| 2403 device_viewport_size_ = device_viewport_size; | 2404 device_viewport_size_ = device_viewport_size; |
| 2404 | 2405 |
| 2405 UpdateViewportContainerSizes(); | 2406 UpdateViewportContainerSizes(); |
| 2406 client_->OnCanDrawStateChanged(CanDraw()); | 2407 client_->OnCanDrawStateChanged(CanDraw()); |
| 2407 SetFullRootLayerDamage(); | 2408 SetFullRootLayerDamage(); |
| 2408 active_tree_->set_needs_update_draw_properties(); | 2409 active_tree_->set_needs_update_draw_properties(); |
| 2409 } | 2410 } |
| 2410 | 2411 |
| 2411 const gfx::Rect LayerTreeHostImpl::ViewportRectForTilePriority() const { | 2412 gfx::Rect LayerTreeHostImpl::ViewportRectForTilePriority() const { |
| 2412 if (viewport_rect_for_tile_priority_.IsEmpty()) | 2413 if (viewport_rect_for_tile_priority_.IsEmpty()) |
| 2413 return DeviceViewport(); | 2414 return DeviceViewport(); |
| 2414 | 2415 |
| 2415 return viewport_rect_for_tile_priority_; | 2416 return viewport_rect_for_tile_priority_; |
| 2416 } | 2417 } |
| 2417 | 2418 |
| 2418 gfx::Size LayerTreeHostImpl::DrawViewportSize() const { | 2419 gfx::Size LayerTreeHostImpl::DrawViewportSize() const { |
| 2420 // XXX DIE DIE DIE DIE | |
|
enne (OOO)
2016/06/28 18:39:02
https://www.youtube.com/watch?v=UrHVBfSaPtA
| |
| 2419 return DeviceViewport().size(); | 2421 return DeviceViewport().size(); |
| 2420 } | 2422 } |
| 2421 | 2423 |
| 2424 gfx::Size LayerTreeHostImpl::GetStableScreenSize( | |
|
enne (OOO)
2016/06/28 18:39:01
How does this relate to gfx::DeviceDisplayInfo::Ge
| |
| 2425 const LayerTreeImpl* tree) const { | |
| 2426 // TODO(crbug.com/622885): Get a stable screen size for any platform from | |
| 2427 // the embedder. | |
| 2428 | |
| 2429 // This size does not include an external viewport size. | |
| 2430 int width = device_viewport_size_.width(); | |
| 2431 int height = device_viewport_size_.height(); | |
| 2432 if (tree->top_controls_shrink_blink_size()) | |
| 2433 height += gfx::ToCeiledInt(tree->top_controls_height() * | |
| 2434 tree->device_scale_factor()); | |
| 2435 | |
| 2436 if (external_viewport_.IsEmpty()) | |
| 2437 return gfx::Size(width, height); | |
| 2438 | |
| 2439 int external_width = external_viewport_.width(); | |
| 2440 int external_height = external_viewport_.height(); | |
| 2441 if (tree->top_controls_shrink_blink_size()) | |
| 2442 external_height += gfx::ToCeiledInt(tree->top_controls_height() * | |
| 2443 tree->device_scale_factor()); | |
| 2444 | |
| 2445 // Take the smaller of the two. An external viewport may be much larger than | |
| 2446 // what will actually be on screen, or much smaller. | |
| 2447 return gfx::Size(std::min(width, external_width), | |
| 2448 std::min(height, external_height)); | |
| 2449 } | |
| 2450 | |
| 2422 gfx::Rect LayerTreeHostImpl::DeviceViewport() const { | 2451 gfx::Rect LayerTreeHostImpl::DeviceViewport() const { |
| 2423 if (external_viewport_.IsEmpty()) | 2452 if (external_viewport_.IsEmpty()) |
| 2424 return gfx::Rect(device_viewport_size_); | 2453 return gfx::Rect(device_viewport_size_); |
| 2425 | 2454 |
| 2426 return external_viewport_; | 2455 return external_viewport_; |
| 2427 } | 2456 } |
| 2428 | 2457 |
| 2429 gfx::Rect LayerTreeHostImpl::DeviceClip() const { | 2458 gfx::Rect LayerTreeHostImpl::DeviceClip() const { |
| 2430 if (external_clip_.IsEmpty()) | 2459 if (external_clip_.IsEmpty()) |
| 2431 return DeviceViewport(); | 2460 return DeviceViewport(); |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4010 return task_runner_provider_->HasImplThread(); | 4039 return task_runner_provider_->HasImplThread(); |
| 4011 } | 4040 } |
| 4012 | 4041 |
| 4013 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4042 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4014 // In single threaded mode we skip the pending tree and commit directly to the | 4043 // In single threaded mode we skip the pending tree and commit directly to the |
| 4015 // active tree. | 4044 // active tree. |
| 4016 return !task_runner_provider_->HasImplThread(); | 4045 return !task_runner_provider_->HasImplThread(); |
| 4017 } | 4046 } |
| 4018 | 4047 |
| 4019 } // namespace cc | 4048 } // namespace cc |
| OLD | NEW |