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

Unified Diff: services/ui/ws/frame_generator.cc

Issue 2613903003: Reland of "Mustash: Ensure surfaces submitted to Mus by WM and embedders contain Surfaces with embe… (Closed)
Patch Set: fix Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/frame_generator.h ('k') | services/ui/ws/frame_generator_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/frame_generator.cc
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc
index 7229a299d751fdbbffde7e42542d11099c94012c..c4c309b00a0f71a193c3c7b3c4e6e0648dba66a0 100644
--- a/services/ui/ws/frame_generator.cc
+++ b/services/ui/ws/frame_generator.cc
@@ -130,7 +130,7 @@ cc::CompositorFrame FrameGenerator::GenerateCompositorFrame(
render_pass->SetNew(render_pass_id, output_rect, output_rect,
gfx::Transform());
- DrawWindowTree(render_pass.get(), root_window_, gfx::Vector2d(), 1.0f);
+ DrawWindow(render_pass.get(), delegate_->GetActiveRootWindow());
cc::CompositorFrame frame;
frame.render_pass_list.push_back(std::move(render_pass));
@@ -155,80 +155,40 @@ cc::CompositorFrame FrameGenerator::GenerateCompositorFrame(
return frame;
}
-void FrameGenerator::DrawWindowTree(
- cc::RenderPass* pass,
- ServerWindow* window,
- const gfx::Vector2d& parent_to_root_origin_offset,
- float opacity) {
- if (!window->visible())
+void FrameGenerator::DrawWindow(cc::RenderPass* pass, ServerWindow* window) {
+ if (!window || !window->visible())
return;
- const gfx::Rect absolute_bounds =
- window->bounds() + parent_to_root_origin_offset;
- const ServerWindow::Windows& children = window->children();
- const float combined_opacity = opacity * window->opacity();
- for (ServerWindow* child : base::Reversed(children)) {
- DrawWindowTree(pass, child, absolute_bounds.OffsetFromOrigin(),
- combined_opacity);
- }
-
if (!window->compositor_frame_sink_manager() ||
!window->compositor_frame_sink_manager()->ShouldDraw())
return;
- cc::SurfaceId underlay_surface_id =
- window->compositor_frame_sink_manager()->GetLatestSurfaceId(
- mojom::CompositorFrameSinkType::UNDERLAY);
cc::SurfaceId default_surface_id =
window->compositor_frame_sink_manager()->GetLatestSurfaceId(
mojom::CompositorFrameSinkType::DEFAULT);
- if (!underlay_surface_id.is_valid() && !default_surface_id.is_valid())
+ if (!default_surface_id.is_valid())
return;
- if (default_surface_id.is_valid()) {
- gfx::Transform quad_to_target_transform;
- quad_to_target_transform.Translate(absolute_bounds.x(),
- absolute_bounds.y());
-
- cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
-
- const gfx::Rect bounds_at_origin(window->bounds().size());
- // TODO(fsamuel): These clipping and visible rects are incorrect. They need
- // to be populated from CompositorFrame structs.
- sqs->SetAll(
- quad_to_target_transform, bounds_at_origin.size() /* layer_bounds */,
- bounds_at_origin /* visible_layer_bounds */,
- bounds_at_origin /* clip_rect */, false /* is_clipped */,
- combined_opacity, SkBlendMode::kSrcOver, 0 /* sorting-context_id */);
- auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
- quad->SetAll(sqs, bounds_at_origin /* rect */,
- gfx::Rect() /* opaque_rect */,
- bounds_at_origin /* visible_rect */, true /* needs_blending*/,
- default_surface_id);
- }
- if (underlay_surface_id.is_valid()) {
- const gfx::Rect underlay_absolute_bounds =
- absolute_bounds - window->underlay_offset();
- gfx::Transform quad_to_target_transform;
- quad_to_target_transform.Translate(underlay_absolute_bounds.x(),
- underlay_absolute_bounds.y());
- cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
- const gfx::Rect bounds_at_origin(
- window->compositor_frame_sink_manager()->GetLatestFrameSize(
- mojom::CompositorFrameSinkType::UNDERLAY));
- sqs->SetAll(
- quad_to_target_transform, bounds_at_origin.size() /* layer_bounds */,
- bounds_at_origin /* visible_layer_bounds */,
- bounds_at_origin /* clip_rect */, false /* is_clipped */,
- combined_opacity, SkBlendMode::kSrcOver, 0 /* sorting-context_id */);
-
- auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
- quad->SetAll(sqs, bounds_at_origin /* rect */,
- gfx::Rect() /* opaque_rect */,
- bounds_at_origin /* visible_rect */, true /* needs_blending*/,
- underlay_surface_id);
- }
+ gfx::Transform quad_to_target_transform;
+ quad_to_target_transform.Translate(window->bounds().x(),
+ window->bounds().y());
+
+ cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
+
+ const gfx::Rect bounds_at_origin(window->bounds().size());
+ // TODO(fsamuel): These clipping and visible rects are incorrect. They need
+ // to be populated from CompositorFrame structs.
+ sqs->SetAll(
+ quad_to_target_transform, bounds_at_origin.size() /* layer_bounds */,
+ bounds_at_origin /* visible_layer_bounds */,
+ bounds_at_origin /* clip_rect */, false /* is_clipped */,
+ 1.0f /* opacity */, SkBlendMode::kSrcOver, 0 /* sorting-context_id */);
+ auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
+ quad->SetAll(sqs, bounds_at_origin /* rect */,
+ gfx::Rect() /* opaque_rect */,
+ bounds_at_origin /* visible_rect */, true /* needs_blending*/,
+ default_surface_id);
}
cc::SurfaceId FrameGenerator::FindParentSurfaceId(ServerWindow* window) {
« no previous file with comments | « services/ui/ws/frame_generator.h ('k') | services/ui/ws/frame_generator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698