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

Side by Side Diff: content/browser/compositor/mus_browser_compositor_output_surface.cc

Issue 2547243002: Set device scale factor in CompositorFrame and scale frame size in WS. (Closed)
Patch Set: test Created 4 years 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 | « no previous file | services/ui/surfaces/display_compositor.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/compositor/mus_browser_compositor_output_surface.h" 5 #include "content/browser/compositor/mus_browser_compositor_output_surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/output_surface_frame.h" 10 #include "cc/output/output_surface_frame.h"
11 #include "cc/quads/render_pass.h" 11 #include "cc/quads/render_pass.h"
12 #include "cc/quads/texture_draw_quad.h" 12 #include "cc/quads/texture_draw_quad.h"
13 #include "components/display_compositor/compositor_overlay_candidate_validator.h " 13 #include "components/display_compositor/compositor_overlay_candidate_validator.h "
14 #include "content/common/gpu/client/context_provider_command_buffer.h" 14 #include "content/common/gpu/client/context_provider_command_buffer.h"
15 #include "gpu/command_buffer/client/gles2_interface.h" 15 #include "gpu/command_buffer/client/gles2_interface.h"
16 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 16 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
17 #include "services/ui/public/cpp/window.h" 17 #include "services/ui/public/cpp/window.h"
18 #include "services/ui/public/cpp/window_compositor_frame_sink.h" 18 #include "services/ui/public/cpp/window_compositor_frame_sink.h"
19 #include "ui/aura/mus/window_compositor_frame_sink.h" 19 #include "ui/aura/mus/window_compositor_frame_sink.h"
20 #include "ui/aura/mus/window_port_mus.h" 20 #include "ui/aura/mus/window_port_mus.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/display/screen.h"
22 23
23 namespace content { 24 namespace content {
24 25
25 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface( 26 MusBrowserCompositorOutputSurface::MusBrowserCompositorOutputSurface(
26 ui::Window* window, 27 ui::Window* window,
27 scoped_refptr<ContextProviderCommandBuffer> context, 28 scoped_refptr<ContextProviderCommandBuffer> context,
28 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 29 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
29 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, 30 const UpdateVSyncParametersCallback& update_vsync_parameters_callback,
30 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 31 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
31 overlay_candidate_validator) 32 overlay_candidate_validator)
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 67
67 cc::BeginFrameSource* MusBrowserCompositorOutputSurface::GetBeginFrameSource() { 68 cc::BeginFrameSource* MusBrowserCompositorOutputSurface::GetBeginFrameSource() {
68 return begin_frame_source_; 69 return begin_frame_source_;
69 } 70 }
70 71
71 void MusBrowserCompositorOutputSurface::SwapBuffers( 72 void MusBrowserCompositorOutputSurface::SwapBuffers(
72 cc::OutputSurfaceFrame frame) { 73 cc::OutputSurfaceFrame frame) {
73 const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size()) 74 const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size())
74 : gfx::Rect(window_->bounds().size()); 75 : gfx::Rect(window_->bounds().size());
75 cc::CompositorFrame ui_frame; 76 cc::CompositorFrame ui_frame;
77 ui_frame.metadata.device_scale_factor = display::Screen::GetScreen()
78 ->GetDisplayNearestWindow(window_)
79 .device_scale_factor();
76 ui_frame.metadata.latency_info = std::move(frame.latency_info); 80 ui_frame.metadata.latency_info = std::move(frame.latency_info);
77 // Reset latency_info to known empty state after moving contents. 81 // Reset latency_info to known empty state after moving contents.
78 frame.latency_info.clear(); 82 frame.latency_info.clear();
79 const int render_pass_id = 1; 83 const int render_pass_id = 1;
80 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 84 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
81 pass->SetNew(render_pass_id, bounds, bounds, gfx::Transform()); 85 pass->SetNew(render_pass_id, bounds, bounds, gfx::Transform());
82 // The SharedQuadState is owned by the SharedQuadStateList 86 // The SharedQuadState is owned by the SharedQuadStateList
83 // shared_quad_state_list. 87 // shared_quad_state_list.
84 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 88 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
85 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds, 89 sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 208
205 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( 209 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId(
206 uint32_t id) { 210 uint32_t id) {
207 DCHECK_LT(id, mailboxes_.size()); 211 DCHECK_LT(id, mailboxes_.size());
208 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == 212 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) ==
209 free_resource_ids_.end()); 213 free_resource_ids_.end());
210 return mailboxes_[id]; 214 return mailboxes_[id];
211 } 215 }
212 216
213 } // namespace content 217 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | services/ui/surfaces/display_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698