diff --git a/obs/display-helpers.hpp b/obs/display-helpers.hpp index de19e5ab6..d175932f3 100644 --- a/obs/display-helpers.hpp +++ b/obs/display-helpers.hpp @@ -40,3 +40,8 @@ static inline void GetScaleAndCenterPos( x = windowCX/2 - newCX/2; y = windowCY/2 - newCY/2; } + +static inline QSize GetPixelSize(QWidget *widget) +{ + return widget->size() * widget->devicePixelRatio(); +} diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 58d725d21..7b9261b4f 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -433,7 +433,7 @@ bool OBSBasic::ResetVideo() //required to make opengl display stuff on osx(?) ResizePreview(ovi.base_width, ovi.base_height); - QSize size = ui->preview->size(); + QSize size = GetPixelSize(ui->preview); ovi.window_width = size.width(); ovi.window_height = size.height(); @@ -515,7 +515,7 @@ void OBSBasic::ResizePreview(uint32_t cx, uint32_t cy) QSize targetSize; /* resize preview panel to fix to the top section of the window */ - targetSize = ui->preview->size(); + targetSize = GetPixelSize(ui->preview); GetScaleAndCenterPos(int(cx), int(cy), targetSize.width(), targetSize.height(), previewX, previewY, previewScale); @@ -555,7 +555,7 @@ void OBSBasic::timerEvent(QTimerEvent *event) killTimer(resizeTimer); resizeTimer = 0; - QSize size = ui->preview->size(); + QSize size = GetPixelSize(ui->preview); obs_resize(size.width(), size.height()); } } diff --git a/obs/window-basic-properties.cpp b/obs/window-basic-properties.cpp index e5950247b..99993892b 100644 --- a/obs/window-basic-properties.cpp +++ b/obs/window-basic-properties.cpp @@ -95,7 +95,7 @@ void OBSBasicProperties::timerEvent(QTimerEvent *event) killTimer(resizeTimer); resizeTimer = 0; - QSize size = ui->preview->size(); + QSize size = GetPixelSize(ui->preview); obs_display_resize(display, size.width(), size.height()); } } @@ -107,7 +107,7 @@ void OBSBasicProperties::Init() show(); App()->processEvents(); - QSize previewSize = ui->preview->size(); + QSize previewSize = GetPixelSize(ui->preview); init_data.cx = uint32_t(previewSize.width()); init_data.cy = uint32_t(previewSize.height()); init_data.format = GS_RGBA;