| OLD | NEW |
| 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 "services/ui/display/platform_screen_ozone.h" | 5 #include "services/ui/display/platform_screen_ozone.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace display { | 21 namespace display { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Needed for DisplayConfigurator::ForceInitialConfigure. | 24 // Needed for DisplayConfigurator::ForceInitialConfigure. |
| 25 const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); | 25 const SkColor kChromeOsBootColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); |
| 26 | 26 |
| 27 const float kInchInMm = 25.4f; | 27 const float kInchInMm = 25.4f; |
| 28 | 28 |
| 29 float ComputeDisplayDPI(const gfx::Size& pixel_size, | 29 float ComputeDisplayDPI(const gfx::Size& pixel_size, |
| 30 const gfx::Size& physical_size) { | 30 const gfx::Size& physical_size) { |
| 31 DCHECK(!physical_size.IsEmpty()); | 31 // The physical_size is broken for some devices, return standard DPI. See |
| 32 // crbug.com/669554. |
| 33 if (physical_size.IsEmpty()) { |
| 34 LOG(ERROR) << "Display has empty phsical_size"; |
| 35 return 96.0f; |
| 36 } |
| 37 |
| 32 return (pixel_size.width() / static_cast<float>(physical_size.width())) * | 38 return (pixel_size.width() / static_cast<float>(physical_size.width())) * |
| 33 kInchInMm; | 39 kInchInMm; |
| 34 } | 40 } |
| 35 | 41 |
| 36 // Finds the device scale factor based on the display DPI. Will use forced | 42 // Finds the device scale factor based on the display DPI. Will use forced |
| 37 // device scale factor if provided via command line. | 43 // device scale factor if provided via command line. |
| 38 float FindDeviceScaleFactor(float dpi) { | 44 float FindDeviceScaleFactor(float dpi) { |
| 39 if (Display::HasForceDeviceScaleFactor()) | 45 if (Display::HasForceDeviceScaleFactor()) |
| 40 return Display::GetForcedDeviceScaleFactor(); | 46 return Display::GetForcedDeviceScaleFactor(); |
| 41 | 47 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 return false; | 380 return false; |
| 375 } | 381 } |
| 376 | 382 |
| 377 void PlatformScreenOzone::Create( | 383 void PlatformScreenOzone::Create( |
| 378 const service_manager::Identity& remote_identity, | 384 const service_manager::Identity& remote_identity, |
| 379 mojom::TestDisplayControllerRequest request) { | 385 mojom::TestDisplayControllerRequest request) { |
| 380 test_bindings_.AddBinding(this, std::move(request)); | 386 test_bindings_.AddBinding(this, std::move(request)); |
| 381 } | 387 } |
| 382 | 388 |
| 383 } // namespace display | 389 } // namespace display |
| OLD | NEW |