From e2cd5b1660658e71d5114cb749f2d21b7829f065 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Wed, 21 Dec 2022 02:37:58 +1100 Subject: [PATCH] qmlglsrc: Handle HiDPI scaling When calculating the capture framebuffer size, include any device scaling applied to the rendered framebuffer Fixes only capturing part of the window when there is a global scale factor. Part-of: --- subprojects/gst-plugins-good/ext/qt/qtwindow.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/qt/qtwindow.cc b/subprojects/gst-plugins-good/ext/qt/qtwindow.cc index ec8f85d89a..daec3222b7 100644 --- a/subprojects/gst-plugins-good/ext/qt/qtwindow.cc +++ b/subprojects/gst-plugins-good/ext/qt/qtwindow.cc @@ -330,8 +330,12 @@ QtGLWindow::getGeometry(int * width, int * height) if (width == NULL || height == NULL) return FALSE; - *width = this->source->width(); - *height = this->source->height(); + double scale = this->source->effectiveDevicePixelRatio(); + *width = this->source->width() * scale; + *height = this->source->height() * scale; + + GST_LOG("Window width %d height %d scale %f", *width, *height, + scale); return TRUE; }