UI: Support fractional scaling for Canvas/Base size

Without this change, new profiles created on systems using a fractional
scaling factor (e.g., 125%, 150%, 175%) will get an incorrect (X, Y)
pair for the new canvas size. For a display with 125% scaling, OBS would
set (1536, 864) instead of (1920, 1080). With this change, it will set
(1920, 1080).
master
Ryan Foster 2020-12-29 11:17:05 -05:00 committed by Jim
parent ac8eaad483
commit 5cdd084c7f
1 changed files with 8 additions and 0 deletions

View File

@ -1218,6 +1218,14 @@ bool OBSBasic::InitBasicConfigDefaults()
uint32_t cx = primaryScreen->size().width(); uint32_t cx = primaryScreen->size().width();
uint32_t cy = primaryScreen->size().height(); uint32_t cy = primaryScreen->size().height();
#ifdef SUPPORTS_FRACTIONAL_SCALING
cx *= devicePixelRatioF();
cy *= devicePixelRatioF();
#elif
cx *= devicePixelRatio();
cy *= devicePixelRatio();
#endif
bool oldResolutionDefaults = config_get_bool( bool oldResolutionDefaults = config_get_bool(
App()->GlobalConfig(), "General", "Pre19Defaults"); App()->GlobalConfig(), "General", "Pre19Defaults");