| 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_win.h" | 5 #include "ui/gfx/screen_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 gfx::Display GetDisplay(MONITORINFOEX& monitor_info) { | 26 gfx::Display GetDisplay(MONITORINFOEX& monitor_info) { |
| 27 // TODO(oshima): Implement Observer. | 27 // TODO(oshima): Implement Observer. |
| 28 int64 id = static_cast<int64>( | 28 int64 id = static_cast<int64>( |
| 29 base::Hash(base::WideToUTF8(monitor_info.szDevice))); | 29 base::Hash(base::WideToUTF8(monitor_info.szDevice))); |
| 30 gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor); | 30 gfx::Rect bounds = gfx::Rect(monitor_info.rcMonitor); |
| 31 gfx::Display display(id, bounds); | 31 gfx::Display display(id, bounds); |
| 32 display.set_work_area(gfx::Rect(monitor_info.rcWork)); | 32 display.set_work_area(gfx::Rect(monitor_info.rcWork)); |
| 33 display.SetScaleAndBounds(gfx::win::GetDeviceScaleFactor(), bounds); | 33 display.SetScaleAndBounds(gfx::win::GetDeviceScaleFactor(), bounds); |
| 34 |
| 35 DEVMODE mode; |
| 36 memset(&mode, 0, sizeof(DEVMODE)); |
| 37 mode.dmSize = sizeof(DEVMODE); |
| 38 mode.dmDriverExtra = 0; |
| 39 if (EnumDisplaySettings(monitor_info.szDevice, |
| 40 ENUM_CURRENT_SETTINGS, |
| 41 &mode)) { |
| 42 switch (mode.dmDisplayOrientation) { |
| 43 case DMDO_DEFAULT: |
| 44 display.set_rotation(gfx::Display::ROTATE_0); |
| 45 break; |
| 46 case DMDO_90: |
| 47 display.set_rotation(gfx::Display::ROTATE_90); |
| 48 break; |
| 49 case DMDO_180: |
| 50 display.set_rotation(gfx::Display::ROTATE_180); |
| 51 break; |
| 52 case DMDO_270: |
| 53 display.set_rotation(gfx::Display::ROTATE_270); |
| 54 break; |
| 55 default: |
| 56 NOTREACHED(); |
| 57 } |
| 58 } |
| 59 |
| 34 return display; | 60 return display; |
| 35 } | 61 } |
| 36 | 62 |
| 37 BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, | 63 BOOL CALLBACK EnumMonitorCallback(HMONITOR monitor, |
| 38 HDC hdc, | 64 HDC hdc, |
| 39 LPRECT rect, | 65 LPRECT rect, |
| 40 LPARAM data) { | 66 LPARAM data) { |
| 41 std::vector<gfx::Display>* all_displays = | 67 std::vector<gfx::Display>* all_displays = |
| 42 reinterpret_cast<std::vector<gfx::Display>*>(data); | 68 reinterpret_cast<std::vector<gfx::Display>*>(data); |
| 43 DCHECK(all_displays); | 69 DCHECK(all_displays); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 NOTREACHED(); | 177 NOTREACHED(); |
| 152 return NULL; | 178 return NULL; |
| 153 } | 179 } |
| 154 | 180 |
| 155 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { | 181 NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { |
| 156 NOTREACHED(); | 182 NOTREACHED(); |
| 157 return NULL; | 183 return NULL; |
| 158 } | 184 } |
| 159 | 185 |
| 160 } // namespace gfx | 186 } // namespace gfx |
| OLD | NEW |