OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/screen.h" | 5 #include "ui/gfx/screen.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gfx/android/device_display_info.h" | 8 #include "ui/gfx/android/device_display_info.h" |
9 #include "ui/gfx/display.h" | 9 #include "ui/gfx/display.h" |
10 #include "ui/gfx/size_conversions.h" | 10 #include "ui/gfx/size_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) | 27 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) |
28 OVERRIDE { | 28 OVERRIDE { |
29 NOTIMPLEMENTED(); | 29 NOTIMPLEMENTED(); |
30 return NULL; | 30 return NULL; |
31 } | 31 } |
32 | 32 |
33 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { | 33 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { |
34 gfx::DeviceDisplayInfo device_info; | 34 gfx::DeviceDisplayInfo device_info; |
35 const float device_scale_factor = device_info.GetDIPScale(); | 35 const float device_scale_factor = device_info.GetDIPScale(); |
36 const gfx::Rect bounds_in_pixels = | 36 const gfx::Rect bounds_in_pixels = |
37 gfx::Rect( | 37 gfx::Rect(device_info.GetPhysicalDisplayWidth() |
38 device_info.GetDisplayWidth(), | 38 ? device_info.GetPhysicalDisplayWidth() |
oshima
2014/07/09 17:44:33
It's not your fault, but the name "Physical" sound
reveman
2014/07/09 18:51:41
Done.
| |
39 device_info.GetDisplayHeight()); | 39 : device_info.GetDisplayWidth(), |
40 device_info.GetPhysicalDisplayHeight() | |
41 ? device_info.GetPhysicalDisplayHeight() | |
42 : device_info.GetDisplayHeight()); | |
40 const gfx::Rect bounds_in_dip = | 43 const gfx::Rect bounds_in_dip = |
41 gfx::Rect(gfx::ToCeiledSize(gfx::ScaleSize( | 44 gfx::Rect(gfx::ToCeiledSize(gfx::ScaleSize( |
42 bounds_in_pixels.size(), 1.0f / device_scale_factor))); | 45 bounds_in_pixels.size(), 1.0f / device_scale_factor))); |
43 gfx::Display display(0, bounds_in_dip); | 46 gfx::Display display(0, bounds_in_dip); |
44 if (!gfx::Display::HasForceDeviceScaleFactor()) | 47 if (!gfx::Display::HasForceDeviceScaleFactor()) |
45 display.set_device_scale_factor(device_scale_factor); | 48 display.set_device_scale_factor(device_scale_factor); |
46 display.SetRotationAsDegree(device_info.GetRotationDegrees()); | 49 display.SetRotationAsDegree(device_info.GetRotationDegrees()); |
47 return display; | 50 return display; |
48 } | 51 } |
49 | 52 |
(...skipping 28 matching lines...) Expand all Loading... | |
78 | 81 |
79 private: | 82 private: |
80 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); | 83 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); |
81 }; | 84 }; |
82 | 85 |
83 Screen* CreateNativeScreen() { | 86 Screen* CreateNativeScreen() { |
84 return new ScreenAndroid; | 87 return new ScreenAndroid; |
85 } | 88 } |
86 | 89 |
87 } // namespace gfx | 90 } // namespace gfx |
OLD | NEW |