Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: win8/metro_driver/direct3d_helper.cc

Issue 300003002: Use the win32 device scale factor in Chrome ASH on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Presubmit warnings Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.cc ('k') | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/direct3d_helper.cc
diff --git a/win8/metro_driver/direct3d_helper.cc b/win8/metro_driver/direct3d_helper.cc
index d0c30cf71219f1d024854e1c25f7f3b4b22291ab..b4da8cd69a0432bde5dfad2fa56963d509017c3c 100644
--- a/win8/metro_driver/direct3d_helper.cc
+++ b/win8/metro_driver/direct3d_helper.cc
@@ -3,16 +3,16 @@
// found in the LICENSE file.
#include "stdafx.h"
-#include "win8/metro_driver/direct3d_helper.h"
-#include "win8/metro_driver/winrt_utils.h"
-
-#include "base/logging.h"
-#include "base/win/windows_version.h"
-
#include <corewindow.h>
#include <windows.applicationmodel.core.h>
#include <windows.graphics.display.h>
+#include "win8/metro_driver/direct3d_helper.h"
+#include "base/logging.h"
+#include "base/win/windows_version.h"
+#include "ui/gfx/win/dpi.h"
+#include "win8/metro_driver/winrt_utils.h"
+
namespace {
void CheckIfFailed(HRESULT hr) {
@@ -21,6 +21,10 @@ void CheckIfFailed(HRESULT hr) {
DVLOG(0) << "Direct3D call failed, hr = " << hr;
}
+// TODO(ananta)
+// This function does not return the correct value as the IDisplayProperties
+// interface does not work correctly in Windows 8 in metro mode. Needs
+// more investigation.
float GetLogicalDpi() {
mswr::ComPtr<wingfx::Display::IDisplayPropertiesStatics> display_properties;
CheckIfFailed(winrt_utils::CreateActivationFactory(
@@ -32,9 +36,7 @@ float GetLogicalDpi() {
}
float ConvertDipsToPixels(float dips) {
- static const float dips_per_inch = 96.f;
- float logical_dpi = GetLogicalDpi();
- return floor(dips * logical_dpi / dips_per_inch + 0.5f);
+ return floor(dips * gfx::GetDPIScale() + 0.5f);
}
}
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.cc ('k') | win8/metro_driver/metro_driver.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698