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

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: Removed include 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
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..0e62a640e627416d3f5265b47436a232a16b7441 100644
--- a/win8/metro_driver/direct3d_helper.cc
+++ b/win8/metro_driver/direct3d_helper.cc
@@ -13,6 +13,8 @@
#include <windows.applicationmodel.core.h>
#include <windows.graphics.display.h>
+#include "ui/gfx/win/dpi.h"
+
namespace {
void CheckIfFailed(HRESULT hr) {
@@ -21,6 +23,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 +38,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);
}
}

Powered by Google App Engine
This is Rietveld 408576698