Index: ui/views/mus/screen_mus.cc |
diff --git a/ui/views/mus/screen_mus.cc b/ui/views/mus/screen_mus.cc |
index d22499cc4b5e2dc03ee3801f10704399d576a39f..faa31ad3463dc1ac9b46a703fc11236c1faf2e7b 100644 |
--- a/ui/views/mus/screen_mus.cc |
+++ b/ui/views/mus/screen_mus.cc |
@@ -17,9 +17,19 @@ namespace mojo { |
template <> |
struct TypeConverter<gfx::Display, mus::mojom::DisplayPtr> { |
static gfx::Display Convert(const mus::mojom::DisplayPtr& input) { |
- gfx::Display result(input->id, input->bounds.To<gfx::Rect>()); |
- result.set_work_area(input->work_area.To<gfx::Rect>()); |
+ gfx::Display result(input->id); |
+ gfx::Rect pixel_bounds = input->bounds.To<gfx::Rect>(); |
+ gfx::Rect pixel_work_area = input->work_area.To<gfx::Rect>(); |
+ float pixel_ratio = input->device_pixel_ratio; |
+ |
+ gfx::Rect dip_bounds = |
+ gfx::ScaleToEnclosingRect(pixel_bounds, 1.f / pixel_ratio); |
+ gfx::Rect dip_work_area = |
+ gfx::ScaleToEnclosingRect(pixel_work_area, 1.f / pixel_ratio); |
+ result.set_bounds(dip_bounds); |
+ result.set_work_area(dip_work_area); |
result.set_device_scale_factor(input->device_pixel_ratio); |
+ |
switch (input->rotation) { |
case mus::mojom::Rotation::VALUE_0: |
result.set_rotation(gfx::Display::ROTATE_0); |