Bug 1240180 - Optimize native theme scaling for the single-monitor case. r=emk

This commit is contained in:
Jonathan Kew 2016-01-18 13:28:26 +00:00
parent 04e7780340
commit 06e58001b4

View File

@ -1550,13 +1550,18 @@ AssumeThemePartAndStateAreTransparent(int32_t aPart, int32_t aState)
// with a different DPI setting from the system's primary monitor, we need to
// apply scaling to native-themed elements as the Windows theme APIs assume
// the primary monitor's resolution.
static double
static inline double
GetThemeDpiScaleFactor(nsIFrame* aFrame)
{
double primaryScale =
WinUtils::LogToPhysFactor(WinUtils::GetPrimaryMonitor());
nsIWidget* rootWidget = aFrame->PresContext()->GetRootWidget();
return rootWidget ? rootWidget->GetDefaultScale().scale / primaryScale : 1.0;
if (WinUtils::IsPerMonitorDPIAware() && GetSystemMetrics(SM_CMONITORS) > 1) {
nsIWidget* rootWidget = aFrame->PresContext()->GetRootWidget();
if (rootWidget) {
double primaryScale =
WinUtils::LogToPhysFactor(WinUtils::GetPrimaryMonitor());
return rootWidget->GetDefaultScale().scale / primaryScale;
}
}
return 1.0;
}
NS_IMETHODIMP