| 74 | CalcStatsParams(); // always run here to recalculate the graph position |
| 75 | } |
| 76 | void CVideoProcessor::UpdateStatsByDisplay() |
| 77 | { |
| 78 | if (m_iResizeStats == 0) { |
| 79 | int dpiH = 0; |
| 80 | |
| 81 | if (IsWindows8OrGreater()) { |
| 82 | static HMODULE hShcore = LoadLibraryW(L"Shcore.dll"); |
| 83 | if (hShcore) { |
| 84 | typedef HRESULT(WINAPI* tpGetDpiForMonitor)(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT* dpiX, UINT* dpiY); |
| 85 | static tpGetDpiForMonitor pGetDpiForMonitor = (tpGetDpiForMonitor)GetProcAddress(hShcore, "GetDpiForMonitor"); |
| 86 | if (pGetDpiForMonitor) { |
| 87 | UINT dpix, dpiy; |
| 88 | if (S_OK == pGetDpiForMonitor(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), MDT_EFFECTIVE_DPI, &dpix, &dpiy)) { |
| 89 | dpiH = dpiy; |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | if (!dpiH) { |
| 96 | HDC hdc = GetDC(nullptr); |
| 97 | if (hdc) { |
| 98 | dpiH = GetDeviceCaps(hdc, LOGPIXELSY); |
| 99 | ReleaseDC(nullptr, hdc); |
| 100 | } |
| 101 | else { |
| 102 | dpiH = 14; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | m_StatsFontH = MulDiv(14, dpiH, 96); |
| 107 | |
| 108 | CalcStatsParams(); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | bool CVideoProcessor::CheckGraphPlacement() |
| 113 | { |