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

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: dsf 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
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()
danakj 2016/12/15 18:58:02 I would normally ask that you plumb this in more d
Fady Samuel 2016/12/15 19:01:00 +1
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 const bool has_transparent_background = true; 85 const bool has_transparent_background = true;
82 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(), 86 pass->SetAll(render_pass_id, bounds, bounds, gfx::Transform(),
83 has_transparent_background); 87 has_transparent_background);
84 // The SharedQuadState is owned by the SharedQuadStateList 88 // The SharedQuadState is owned by the SharedQuadStateList
85 // shared_quad_state_list. 89 // shared_quad_state_list.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 210
207 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId( 211 const gpu::Mailbox& MusBrowserCompositorOutputSurface::GetMailboxFromResourceId(
208 uint32_t id) { 212 uint32_t id) {
209 DCHECK_LT(id, mailboxes_.size()); 213 DCHECK_LT(id, mailboxes_.size());
210 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) == 214 DCHECK(std::find(free_resource_ids_.begin(), free_resource_ids_.end(), id) ==
211 free_resource_ids_.end()); 215 free_resource_ids_.end());
212 return mailboxes_[id]; 216 return mailboxes_[id];
213 } 217 }
214 218
215 } // namespace content 219 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | services/ui/surfaces/display_compositor.cc » ('j') | services/ui/surfaces/display_compositor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698