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/display/screen.h" | 5 #include "ui/display/screen.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/display/display.h" | 9 #include "ui/display/display.h" |
10 #include "ui/gfx/android/device_display_info.h" | 10 #include "ui/gfx/android/device_display_info.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ? device_info.GetPhysicalDisplayHeight() | 42 ? device_info.GetPhysicalDisplayHeight() |
43 : device_info.GetDisplayHeight()); | 43 : device_info.GetDisplayHeight()); |
44 const gfx::Rect bounds_in_dip = gfx::Rect(gfx::ScaleToCeiledSize( | 44 const gfx::Rect bounds_in_dip = gfx::Rect(gfx::ScaleToCeiledSize( |
45 bounds_in_pixels.size(), 1.0f / device_scale_factor)); | 45 bounds_in_pixels.size(), 1.0f / device_scale_factor)); |
46 Display display(0, bounds_in_dip); | 46 Display display(0, bounds_in_dip); |
47 if (!Display::HasForceDeviceScaleFactor()) | 47 if (!Display::HasForceDeviceScaleFactor()) |
48 display.set_device_scale_factor(device_scale_factor); | 48 display.set_device_scale_factor(device_scale_factor); |
49 display.SetRotationAsDegree(device_info.GetRotationDegrees()); | 49 display.SetRotationAsDegree(device_info.GetRotationDegrees()); |
50 display.set_color_depth(device_info.GetBitsPerPixel()); | 50 display.set_color_depth(device_info.GetBitsPerPixel()); |
51 display.set_depth_per_component(device_info.GetBitsPerComponent()); | 51 display.set_depth_per_component(device_info.GetBitsPerComponent()); |
52 display.set_is_monochrome(device_info.GetBitsPerComponent() == 0); | |
53 return display; | 52 return display; |
54 } | 53 } |
55 | 54 |
56 Display GetDisplayNearestWindow(gfx::NativeView view) const override { | 55 Display GetDisplayNearestWindow(gfx::NativeView view) const override { |
57 return GetPrimaryDisplay(); | 56 return GetPrimaryDisplay(); |
58 } | 57 } |
59 | 58 |
60 Display GetDisplayNearestPoint(const gfx::Point& point) const override { | 59 Display GetDisplayNearestPoint(const gfx::Point& point) const override { |
61 return GetPrimaryDisplay(); | 60 return GetPrimaryDisplay(); |
62 } | 61 } |
(...skipping 18 matching lines...) Expand all Loading... |
81 | 80 |
82 private: | 81 private: |
83 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); | 82 DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); |
84 }; | 83 }; |
85 | 84 |
86 Screen* CreateNativeScreen() { | 85 Screen* CreateNativeScreen() { |
87 return new ScreenAndroid; | 86 return new ScreenAndroid; |
88 } | 87 } |
89 | 88 |
90 } // namespace display | 89 } // namespace display |
OLD | NEW |