On 27.01.2019 22:51, Carl Eugen Hoyos wrote:
2019-01-27 1:45 GMT+01:00, Carl Eugen Hoyos <ceffm...@gmail.com>:
2019-01-26 18:53 GMT+01:00, Dilshod Mukhtarov <dilsh...@gmail.com>:
HI, this is the patch that fixes HIDPI support in gdigrab
+ double h_dpr; // Horizontal device pixel ratio
+ double v_dpr; // Vertical device pixel ratio
I would expect these to be AVRational, if this is not
possible, it should be explained why.
Sorry if this was not an ideal comment, it should have been:
All aspect ratio calculations (and all calculations related to
aspect ratio) do not need double (or floats) but should be
done as integer calculations. AVRational structs are often
used, theoretically they may not be needed.
I attached new version of the patch, which uses integer arithmetics
--
With the best regards,
Dilshod
>From 1db3c6d3bc8320330cd2908ef50c27e55dcfdf43 Mon Sep 17 00:00:00 2001
From: Dilshod Mukhtarov <dilsh...@gmail.com>
Date: Sun, 27 Jan 2019 23:09:53 +0400
Subject: [PATCH 1/2] libavdevice/gdigrab: fix HIDPI support for window capture
In Windows if using scaling other than 100% then the grabbed window was not captured fully (cropped)
Signed-off-by: Dilshod Mukhtarov <dilsh...@gmail.com>
---
libavdevice/gdigrab.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index ab08c11788..0e6ae2bd5d 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -277,14 +277,20 @@ gdigrab_read_header(AVFormatContext *s1)
}
bpp = GetDeviceCaps(source_hdc, BITSPIXEL);
+ horzres = GetDeviceCaps(source_hdc, HORZRES);
+ vertres = GetDeviceCaps(source_hdc, VERTRES);
+ desktophorzres = GetDeviceCaps(source_hdc, DESKTOPHORZRES);
+ desktopvertres = GetDeviceCaps(source_hdc, DESKTOPVERTRES);
+
if (hwnd) {
GetClientRect(hwnd, &virtual_rect);
+ /* window -- get the right height and width for scaling DPI */
+ virtual_rect.left = virtual_rect.left * desktophorzres / horzres;
+ virtual_rect.right = virtual_rect.right * desktophorzres / horzres;
+ virtual_rect.top = virtual_rect.top * desktopvertres / vertres;
+ virtual_rect.bottom = virtual_rect.bottom * desktopvertres / vertres;
} else {
/* desktop -- get the right height and width for scaling DPI */
- horzres = GetDeviceCaps(source_hdc, HORZRES);
- vertres = GetDeviceCaps(source_hdc, VERTRES);
- desktophorzres = GetDeviceCaps(source_hdc, DESKTOPHORZRES);
- desktopvertres = GetDeviceCaps(source_hdc, DESKTOPVERTRES);
virtual_rect.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
virtual_rect.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
virtual_rect.right = (virtual_rect.left + GetSystemMetrics(SM_CXVIRTUALSCREEN)) * desktophorzres / horzres;
--
2.17.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel