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 mus { | 47 namespace view_manager { |
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 // static | 95 // static |
96 DisplayManagerFactory* DisplayManager::factory_ = nullptr; | 96 DisplayManagerFactory* DisplayManager::factory_ = nullptr; |
97 | 97 |
98 // static | 98 // static |
99 DisplayManager* DisplayManager::Create( | 99 DisplayManager* DisplayManager::Create( |
100 bool is_headless, | 100 bool is_headless, |
101 mojo::ApplicationImpl* app_impl, | 101 mojo::ApplicationImpl* app_impl, |
102 const scoped_refptr<GpuState>& gpu_state, | 102 const scoped_refptr<gles2::GpuState>& gpu_state, |
103 const scoped_refptr<SurfacesState>& surfaces_state) { | 103 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) { |
104 if (factory_) { | 104 if (factory_) { |
105 return factory_->CreateDisplayManager(is_headless, app_impl, gpu_state, | 105 return factory_->CreateDisplayManager(is_headless, app_impl, gpu_state, |
106 surfaces_state); | 106 surfaces_state); |
107 } | 107 } |
108 return new DefaultDisplayManager(is_headless, app_impl, gpu_state, | 108 return new DefaultDisplayManager(is_headless, app_impl, gpu_state, |
109 surfaces_state); | 109 surfaces_state); |
110 } | 110 } |
111 | 111 |
112 DefaultDisplayManager::DefaultDisplayManager( | 112 DefaultDisplayManager::DefaultDisplayManager( |
113 bool is_headless, | 113 bool is_headless, |
114 mojo::ApplicationImpl* app_impl, | 114 mojo::ApplicationImpl* app_impl, |
115 const scoped_refptr<GpuState>& gpu_state, | 115 const scoped_refptr<gles2::GpuState>& gpu_state, |
116 const scoped_refptr<SurfacesState>& surfaces_state) | 116 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) |
117 : is_headless_(is_headless), | 117 : is_headless_(is_headless), |
118 app_impl_(app_impl), | 118 app_impl_(app_impl), |
119 gpu_state_(gpu_state), | 119 gpu_state_(gpu_state), |
120 surfaces_state_(surfaces_state), | 120 surfaces_state_(surfaces_state), |
121 delegate_(nullptr), | 121 delegate_(nullptr), |
122 draw_timer_(false, false), | 122 draw_timer_(false, false), |
123 frame_pending_(false), | 123 frame_pending_(false), |
124 weak_factory_(this) { | 124 weak_factory_(this) { |
125 metrics_.size_in_pixels = mojo::Size::New(); | 125 metrics_.size_in_pixels = mojo::Size::New(); |
126 metrics_.size_in_pixels->width = 800; | 126 metrics_.size_in_pixels->width = 800; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 void DefaultDisplayManager::OnWindowStateChanged( | 335 void DefaultDisplayManager::OnWindowStateChanged( |
336 ui::PlatformWindowState new_state) {} | 336 ui::PlatformWindowState new_state) {} |
337 | 337 |
338 void DefaultDisplayManager::OnLostCapture() {} | 338 void DefaultDisplayManager::OnLostCapture() {} |
339 | 339 |
340 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( | 340 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( |
341 gfx::AcceleratedWidget widget, | 341 gfx::AcceleratedWidget widget, |
342 float device_pixel_ratio) { | 342 float device_pixel_ratio) { |
343 if (widget != gfx::kNullAcceleratedWidget) { | 343 if (widget != gfx::kNullAcceleratedWidget) { |
344 top_level_display_client_.reset( | 344 top_level_display_client_.reset(new surfaces::TopLevelDisplayClient( |
345 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); | 345 widget, gpu_state_, surfaces_state_)); |
346 } | 346 } |
347 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); | 347 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); |
348 } | 348 } |
349 | 349 |
350 void DefaultDisplayManager::OnActivationChanged(bool active) {} | 350 void DefaultDisplayManager::OnActivationChanged(bool active) {} |
351 | 351 |
352 } // namespace mus | 352 } // namespace view_manager |
OLD | NEW |