| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/display_manager.h" | 5 #include "components/mus/display_manager.h" |
| 6 | 6 |
| 7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/delegated_frame_data.h" | 9 #include "cc/output/delegated_frame_data.h" |
| 10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "ui/platform_window/win/win_window.h" | 37 #include "ui/platform_window/win/win_window.h" |
| 38 #elif defined(USE_X11) | 38 #elif defined(USE_X11) |
| 39 #include "ui/platform_window/x11/x11_window.h" | 39 #include "ui/platform_window/x11/x11_window.h" |
| 40 #elif defined(OS_ANDROID) | 40 #elif defined(OS_ANDROID) |
| 41 #include "ui/platform_window/android/platform_window_android.h" | 41 #include "ui/platform_window/android/platform_window_android.h" |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 using mojo::Rect; | 44 using mojo::Rect; |
| 45 using mojo::Size; | 45 using mojo::Size; |
| 46 | 46 |
| 47 namespace view_manager { | 47 namespace mus { |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 void DrawViewTree(cc::RenderPass* pass, | 50 void DrawViewTree(cc::RenderPass* pass, |
| 51 const ServerView* view, | 51 const ServerView* view, |
| 52 const gfx::Vector2d& parent_to_root_origin_offset, | 52 const gfx::Vector2d& parent_to_root_origin_offset, |
| 53 float opacity) { | 53 float opacity) { |
| 54 if (!view->visible()) | 54 if (!view->visible()) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 const gfx::Rect absolute_bounds = | 57 const gfx::Rect absolute_bounds = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 83 | 83 |
| 84 } // namespace | 84 } // namespace |
| 85 | 85 |
| 86 // static | 86 // static |
| 87 DisplayManagerFactory* DisplayManager::factory_ = nullptr; | 87 DisplayManagerFactory* DisplayManager::factory_ = nullptr; |
| 88 | 88 |
| 89 // static | 89 // static |
| 90 DisplayManager* DisplayManager::Create( | 90 DisplayManager* DisplayManager::Create( |
| 91 bool is_headless, | 91 bool is_headless, |
| 92 mojo::ApplicationImpl* app_impl, | 92 mojo::ApplicationImpl* app_impl, |
| 93 const scoped_refptr<gles2::GpuState>& gpu_state, | 93 const scoped_refptr<GpuState>& gpu_state, |
| 94 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) { | 94 const scoped_refptr<SurfacesState>& surfaces_state) { |
| 95 if (factory_) { | 95 if (factory_) { |
| 96 return factory_->CreateDisplayManager(is_headless, app_impl, gpu_state, | 96 return factory_->CreateDisplayManager(is_headless, app_impl, gpu_state, |
| 97 surfaces_state); | 97 surfaces_state); |
| 98 } | 98 } |
| 99 return new DefaultDisplayManager(is_headless, app_impl, gpu_state, | 99 return new DefaultDisplayManager(is_headless, app_impl, gpu_state, |
| 100 surfaces_state); | 100 surfaces_state); |
| 101 } | 101 } |
| 102 | 102 |
| 103 DefaultDisplayManager::DefaultDisplayManager( | 103 DefaultDisplayManager::DefaultDisplayManager( |
| 104 bool is_headless, | 104 bool is_headless, |
| 105 mojo::ApplicationImpl* app_impl, | 105 mojo::ApplicationImpl* app_impl, |
| 106 const scoped_refptr<gles2::GpuState>& gpu_state, | 106 const scoped_refptr<GpuState>& gpu_state, |
| 107 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) | 107 const scoped_refptr<SurfacesState>& surfaces_state) |
| 108 : is_headless_(is_headless), | 108 : is_headless_(is_headless), |
| 109 app_impl_(app_impl), | 109 app_impl_(app_impl), |
| 110 gpu_state_(gpu_state), | 110 gpu_state_(gpu_state), |
| 111 surfaces_state_(surfaces_state), | 111 surfaces_state_(surfaces_state), |
| 112 delegate_(nullptr), | 112 delegate_(nullptr), |
| 113 draw_timer_(false, false), | 113 draw_timer_(false, false), |
| 114 frame_pending_(false), | 114 frame_pending_(false), |
| 115 weak_factory_(this) { | 115 weak_factory_(this) { |
| 116 metrics_.size_in_pixels = mojo::Size::New(); | 116 metrics_.size_in_pixels = mojo::Size::New(); |
| 117 metrics_.size_in_pixels->width = 800; | 117 metrics_.size_in_pixels->width = 800; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 314 |
| 315 void DefaultDisplayManager::OnWindowStateChanged( | 315 void DefaultDisplayManager::OnWindowStateChanged( |
| 316 ui::PlatformWindowState new_state) {} | 316 ui::PlatformWindowState new_state) {} |
| 317 | 317 |
| 318 void DefaultDisplayManager::OnLostCapture() {} | 318 void DefaultDisplayManager::OnLostCapture() {} |
| 319 | 319 |
| 320 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( | 320 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( |
| 321 gfx::AcceleratedWidget widget, | 321 gfx::AcceleratedWidget widget, |
| 322 float device_pixel_ratio) { | 322 float device_pixel_ratio) { |
| 323 if (widget != gfx::kNullAcceleratedWidget) { | 323 if (widget != gfx::kNullAcceleratedWidget) { |
| 324 top_level_display_client_.reset(new surfaces::TopLevelDisplayClient( | 324 top_level_display_client_.reset( |
| 325 widget, gpu_state_, surfaces_state_)); | 325 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); |
| 326 } | 326 } |
| 327 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); | 327 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void DefaultDisplayManager::OnActivationChanged(bool active) {} | 330 void DefaultDisplayManager::OnActivationChanged(bool active) {} |
| 331 | 331 |
| 332 } // namespace view_manager | 332 } // namespace mus |
| OLD | NEW |