From e71b5f81b8fa43025caa30b94dbf1f9abbb4f769 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Fri, 15 Oct 2021 09:56:51 +0800 Subject: [PATCH 47/51] winex11.drv: Add map_dpi_rect() helper. To: wine-devel@winehq.org Signed-off-by: Zhiyi Zhang --- dlls/winex11.drv/window.c | 12 ++++++++++++ dlls/winex11.drv/x11drv.h | 1 + 2 files changed, 13 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index ff97e0f1eea..0d2849ca3b6 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1589,6 +1589,18 @@ POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) return pt; } +RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ) +{ + if (dpi_from && dpi_to && dpi_from != dpi_to) + { + rect.left = MulDiv( rect.left, dpi_to, dpi_from ); + rect.top = MulDiv( rect.top, dpi_to, dpi_from ); + rect.right = MulDiv( rect.right, dpi_to, dpi_from ); + rect.bottom = MulDiv( rect.bottom, dpi_to, dpi_from ); + } + return rect; +} + /********************************************************************** * create_whole_window * diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 586635cbb8c..ac7d1eb683d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -714,6 +714,7 @@ extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN; /* DPI unaware scaling helpers */ extern RECT dpi_unaware_get_virtual_screen_rect(void) DECLSPEC_HIDDEN; extern POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDDEN; +extern RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDDEN; #define DEPTH_COUNT 3 extern const unsigned int *depths DECLSPEC_HIDDEN; -- 2.32.0