OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "stdafx.h" | 5 #include "stdafx.h" |
6 #include "win8/metro_driver/direct3d_helper.h" | 6 #include "win8/metro_driver/direct3d_helper.h" |
7 #include "win8/metro_driver/winrt_utils.h" | 7 #include "win8/metro_driver/winrt_utils.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 #include <windows.graphics.display.h> | 11 #include <windows.graphics.display.h> |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 void CheckIfFailed(HRESULT hr) { | 15 void CheckIfFailed(HRESULT hr) { |
16 DCHECK(!FAILED(hr)); | 16 DCHECK(!FAILED(hr)); |
17 if (FAILED(hr)) | 17 if (FAILED(hr)) |
18 DVLOG(ERROR) << "Direct3D call failed, hr = " << hr; | 18 DVLOG(0) << "Direct3D call failed, hr = " << hr; |
19 } | 19 } |
20 | 20 |
21 float GetLogicalDpi() { | 21 float GetLogicalDpi() { |
22 mswr::ComPtr<wingfx::Display::IDisplayPropertiesStatics> display_properties; | 22 mswr::ComPtr<wingfx::Display::IDisplayPropertiesStatics> display_properties; |
23 CheckIfFailed(winrt_utils::CreateActivationFactory( | 23 CheckIfFailed(winrt_utils::CreateActivationFactory( |
24 RuntimeClass_Windows_Graphics_Display_DisplayProperties, | 24 RuntimeClass_Windows_Graphics_Display_DisplayProperties, |
25 display_properties.GetAddressOf())); | 25 display_properties.GetAddressOf())); |
26 float dpi = 0.0; | 26 float dpi = 0.0; |
27 CheckIfFailed(display_properties->get_LogicalDpi(&dpi)); | 27 CheckIfFailed(display_properties->get_LogicalDpi(&dpi)); |
28 return dpi; | 28 return dpi; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 CheckIfFailed(dxgi_factory->CreateSwapChainForCoreWindow( | 119 CheckIfFailed(dxgi_factory->CreateSwapChainForCoreWindow( |
120 d3d_device_.Get(), | 120 d3d_device_.Get(), |
121 reinterpret_cast<IUnknown*>(window_), | 121 reinterpret_cast<IUnknown*>(window_), |
122 &swap_chain_desc, | 122 &swap_chain_desc, |
123 nullptr, | 123 nullptr, |
124 &swap_chain_)); | 124 &swap_chain_)); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 } // namespace metro_driver | 128 } // namespace metro_driver |
OLD | NEW |