From fd9c2c803363d2036ba497946c2eee58b4c4fe18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Thu, 27 May 2021 08:44:11 +0200 Subject: [PATCH] Silence warning C4996 (use of deprecated GetDesktopDpi) Silences warnings warning C4996: 'ID2D1Factory::GetDesktopDpi': Deprecated. Use DisplayInformation::LogicalDpi for Windows Store Apps or GetDpiForWindow for desktop apps. Using GetDpiForWindow sounds like the right approach, but it's not obvious where to get the window handle from here. Task-number: QTBUG-94043 Pick-to: 6.1 Change-Id: I2fc005e0c970c8338184f4500b876774ec9d976b Reviewed-by: Friedemann Kleint --- src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp | 3 +++ src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp index 587bae3598..feb8f29214 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbitmap.cpp @@ -65,8 +65,11 @@ public: D2D1_BITMAP_PROPERTIES1 bitmapProperties() const { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED // see QTBUG-94043 FLOAT dpiX, dpiY; QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&dpiX, &dpiY); +QT_WARNING_POP return D2D1::BitmapProperties1( D2D1_BITMAP_OPTIONS_TARGET, diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp index 3c86168a74..f624d5d2ba 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.cpp @@ -103,6 +103,8 @@ int QWindowsDirect2DPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) case QPaintDevice::PdmDpiX: case QPaintDevice::PdmPhysicalDpiX: { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED // See QTBUG-94043 FLOAT x, y; QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&x, &y); return qRound(x); @@ -113,6 +115,7 @@ int QWindowsDirect2DPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) FLOAT x, y; QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&x, &y); return qRound(y); +QT_WARNING_POP } case QPaintDevice::PdmDevicePixelRatio: return 1;