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

Unified Diff: content/browser/compositor/mus_browser_compositor_output_surface.cc

Issue 2644983002: Scale bounds from dip to pixels in CompositorFrame in content::MusBrowserCompositorOutputSurface. (Closed)
Patch Set: 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/mus_browser_compositor_output_surface.cc
diff --git a/content/browser/compositor/mus_browser_compositor_output_surface.cc b/content/browser/compositor/mus_browser_compositor_output_surface.cc
index 32058ce694b02fa6642838dd1a24dbd59844921b..91b07fd0ba9ecccdc722bb8ad78f8a15caa6ce66 100644
--- a/content/browser/compositor/mus_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/mus_browser_compositor_output_surface.cc
@@ -20,6 +20,7 @@
#include "ui/aura/mus/window_port_mus.h"
#include "ui/aura/window.h"
#include "ui/display/screen.h"
+#include "ui/gfx/geometry/dip_util.h"
namespace content {
@@ -71,8 +72,6 @@ cc::BeginFrameSource* MusBrowserCompositorOutputSurface::GetBeginFrameSource() {
void MusBrowserCompositorOutputSurface::SwapBuffers(
cc::OutputSurfaceFrame frame) {
- const gfx::Rect bounds = ui_window_ ? gfx::Rect(ui_window_->bounds().size())
- : gfx::Rect(window_->bounds().size());
cc::CompositorFrame ui_frame;
ui_frame.metadata.device_scale_factor = display::Screen::GetScreen()
->GetDisplayNearestWindow(window_)
@@ -81,14 +80,20 @@ void MusBrowserCompositorOutputSurface::SwapBuffers(
// Reset latency_info to known empty state after moving contents.
frame.latency_info.clear();
const int render_pass_id = 1;
+ const gfx::Rect bounds_in_dip = ui_window_
+ ? gfx::Rect(ui_window_->bounds().size())
+ : gfx::Rect(window_->bounds().size());
+ const gfx::Rect bounds_in_pixels = gfx::ConvertRectToPixel(
+ ui_frame.metadata.device_scale_factor, bounds_in_dip);
std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
- pass->SetNew(render_pass_id, bounds, bounds, gfx::Transform());
+ pass->SetNew(render_pass_id, bounds_in_pixels, bounds_in_pixels,
+ gfx::Transform());
// The SharedQuadState is owned by the SharedQuadStateList
// shared_quad_state_list.
cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
- sqs->SetAll(gfx::Transform(), bounds.size(), bounds, bounds,
- false /* is_clipped */, 1.f /* opacity */, SkBlendMode::kSrc,
- 0 /* sorting_context_id */);
+ sqs->SetAll(gfx::Transform(), bounds_in_pixels.size(), bounds_in_pixels,
+ bounds_in_pixels, false /* is_clipped */, 1.f /* opacity */,
+ SkBlendMode::kSrc, 0 /* sorting_context_id */);
cc::TransferableResource resource;
resource.id = AllocateResourceId();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698