From f3b8f1d5b028bf1a0789766f638762b7fea9f446 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 aefac15d31..9ab56f7f71 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; }