Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: components/mus/vm/display_manager.cc

Issue 1377493002: mus: move View Manager to components/mus/vm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/mus/vm/display_manager.h ('k') | components/mus/vm/display_manager_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/vm/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"
11 #include "cc/quads/shared_quad_state.h" 11 #include "cc/quads/shared_quad_state.h"
12 #include "cc/quads/surface_draw_quad.h" 12 #include "cc/quads/surface_draw_quad.h"
13 #include "components/mus/display_manager_factory.h"
14 #include "components/mus/gles2/gpu_state.h" 13 #include "components/mus/gles2/gpu_state.h"
15 #include "components/mus/public/interfaces/gpu.mojom.h" 14 #include "components/mus/public/interfaces/gpu.mojom.h"
16 #include "components/mus/public/interfaces/quads.mojom.h" 15 #include "components/mus/public/interfaces/quads.mojom.h"
17 #include "components/mus/server_view.h"
18 #include "components/mus/surfaces/surfaces_state.h" 16 #include "components/mus/surfaces/surfaces_state.h"
19 #include "components/mus/view_coordinate_conversions.h" 17 #include "components/mus/vm/display_manager_factory.h"
18 #include "components/mus/vm/server_view.h"
19 #include "components/mus/vm/view_coordinate_conversions.h"
20 #include "mojo/application/public/cpp/application_connection.h" 20 #include "mojo/application/public/cpp/application_connection.h"
21 #include "mojo/application/public/cpp/application_impl.h" 21 #include "mojo/application/public/cpp/application_impl.h"
22 #include "mojo/converters/geometry/geometry_type_converters.h" 22 #include "mojo/converters/geometry/geometry_type_converters.h"
23 #include "mojo/converters/input_events/input_events_type_converters.h" 23 #include "mojo/converters/input_events/input_events_type_converters.h"
24 #include "mojo/converters/input_events/mojo_extended_key_event_data.h" 24 #include "mojo/converters/input_events/mojo_extended_key_event_data.h"
25 #include "mojo/converters/surfaces/surfaces_type_converters.h" 25 #include "mojo/converters/surfaces/surfaces_type_converters.h"
26 #include "mojo/converters/surfaces/surfaces_utils.h" 26 #include "mojo/converters/surfaces/surfaces_utils.h"
27 #include "mojo/converters/transform/transform_type_converters.h" 27 #include "mojo/converters/transform/transform_type_converters.h"
28 #include "third_party/skia/include/core/SkXfermode.h" 28 #include "third_party/skia/include/core/SkXfermode.h"
29 #include "ui/events/event.h" 29 #include "ui/events/event.h"
(...skipping 29 matching lines...) Expand all
59 if (!view->visible()) 59 if (!view->visible())
60 return; 60 return;
61 61
62 const gfx::Rect absolute_bounds = 62 const gfx::Rect absolute_bounds =
63 view->bounds() + parent_to_root_origin_offset; 63 view->bounds() + parent_to_root_origin_offset;
64 64
65 std::vector<const ServerView*> children(view->GetChildren()); 65 std::vector<const ServerView*> children(view->GetChildren());
66 // TODO(rjkroege, fsamuel): Make sure we're handling alpha correctly. 66 // TODO(rjkroege, fsamuel): Make sure we're handling alpha correctly.
67 const float combined_opacity = opacity * view->opacity(); 67 const float combined_opacity = opacity * view->opacity();
68 for (auto it = children.rbegin(); it != children.rend(); ++it) { 68 for (auto it = children.rbegin(); it != children.rend(); ++it) {
69 DrawViewTree(pass, *it, absolute_bounds.OffsetFromOrigin(), 69 DrawViewTree(
70 combined_opacity, 70 pass, *it, absolute_bounds.OffsetFromOrigin(), combined_opacity,
71 view->parent() && 71 view->parent() && !view->surface_id().is_null() /* skip_view */);
72 !view->surface_id().is_null() /* skip_view */);
73 } 72 }
74 73
75 if (skip_view || view->surface_id().is_null()) 74 if (skip_view || view->surface_id().is_null())
76 return; 75 return;
77 76
78 gfx::Transform quad_to_target_transform; 77 gfx::Transform quad_to_target_transform;
79 quad_to_target_transform.Translate(absolute_bounds.x(), absolute_bounds.y()); 78 quad_to_target_transform.Translate(absolute_bounds.x(), absolute_bounds.y());
80 gfx::Rect bounds_at_origin(view->bounds().size()); 79 gfx::Rect bounds_at_origin(view->bounds().size());
81 80
82 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 81 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 239
241 delegate_->OnViewportMetricsChanged(old_metrics, metrics_); 240 delegate_->OnViewportMetricsChanged(old_metrics, metrics_);
242 } 241 }
243 242
244 scoped_ptr<cc::CompositorFrame> 243 scoped_ptr<cc::CompositorFrame>
245 DefaultDisplayManager::GenerateCompositorFrame() { 244 DefaultDisplayManager::GenerateCompositorFrame() {
246 scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); 245 scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
247 render_pass->damage_rect = dirty_rect_; 246 render_pass->damage_rect = dirty_rect_;
248 render_pass->output_rect = gfx::Rect(metrics_.size_in_pixels.To<gfx::Size>()); 247 render_pass->output_rect = gfx::Rect(metrics_.size_in_pixels.To<gfx::Size>());
249 248
250 DrawViewTree(render_pass.get(), 249 DrawViewTree(render_pass.get(), delegate_->GetRootView(), gfx::Vector2d(),
251 delegate_->GetRootView(), 250 1.0f, false /* skip_view */);
252 gfx::Vector2d(), 1.0f,
253 false /* skip_view */);
254 251
255 scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); 252 scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData);
256 frame_data->device_scale_factor = metrics_.device_pixel_ratio; 253 frame_data->device_scale_factor = metrics_.device_pixel_ratio;
257 frame_data->render_pass_list.push_back(render_pass.Pass()); 254 frame_data->render_pass_list.push_back(render_pass.Pass());
258 255
259 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 256 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
260 frame->delegated_frame_data = frame_data.Pass(); 257 frame->delegated_frame_data = frame_data.Pass();
261 return frame.Pass(); 258 return frame.Pass();
262 } 259 }
263 260
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_)); 337 new TopLevelDisplayClient(widget, gpu_state_, surfaces_state_));
341 delegate_->OnTopLevelSurfaceChanged( 338 delegate_->OnTopLevelSurfaceChanged(
342 top_level_display_client_->surface_id()); 339 top_level_display_client_->surface_id());
343 } 340 }
344 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); 341 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio);
345 } 342 }
346 343
347 void DefaultDisplayManager::OnActivationChanged(bool active) {} 344 void DefaultDisplayManager::OnActivationChanged(bool active) {}
348 345
349 } // namespace mus 346 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/vm/display_manager.h ('k') | components/mus/vm/display_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698