diff --git a/src/single_window/render.cpp b/src/single_window/render.cpp index 603d671..cc10930 100644 --- a/src/single_window/render.cpp +++ b/src/single_window/render.cpp @@ -729,6 +729,15 @@ int Render::SetupMainWindow() { SetupFontAndStyle(); + SDL_GetWindowSizeInPixels(main_window_, &main_window_width_real_, + &main_window_height_real_); + main_window_dpi_scaling_w_ = main_window_width_real_ / main_window_width_; + main_window_dpi_scaling_h_ = main_window_width_real_ / main_window_width_; + SDL_SetRenderScale(main_renderer_, main_window_dpi_scaling_w_, + main_window_dpi_scaling_h_); + LOG_INFO("Use dpi scaling [{}x{}] for main window", + main_window_dpi_scaling_w_, main_window_dpi_scaling_h_); + ImGui_ImplSDL3_InitForSDLRenderer(main_window_, main_renderer_); ImGui_ImplSDLRenderer3_Init(main_renderer_); @@ -758,6 +767,19 @@ int Render::SetupStreamWindow() { SetupFontAndStyle(); + SDL_GetWindowSizeInPixels(stream_window_, &stream_window_width_real_, + &stream_window_height_real_); + + stream_window_dpi_scaling_w_ = + stream_window_width_real_ / stream_window_width_; + stream_window_dpi_scaling_h_ = + stream_window_width_real_ / stream_window_width_; + + SDL_SetRenderScale(stream_renderer_, stream_window_dpi_scaling_w_, + stream_window_dpi_scaling_h_); + LOG_INFO("Use dpi scaling [{}x{}] for stream window", + stream_window_dpi_scaling_w_, stream_window_dpi_scaling_h_); + ImGui_ImplSDL3_InitForSDLRenderer(stream_window_, stream_renderer_); ImGui_ImplSDLRenderer3_Init(stream_renderer_); diff --git a/src/single_window/render.h b/src/single_window/render.h index 764736b..a9ce56e 100644 --- a/src/single_window/render.h +++ b/src/single_window/render.h @@ -301,6 +301,10 @@ class Render { bool foucs_on_main_window_ = false; bool foucs_on_stream_window_ = false; bool audio_capture_ = false; + int main_window_width_real_ = 720; + int main_window_height_real_ = 540; + float main_window_dpi_scaling_w_ = 1.0f; + float main_window_dpi_scaling_h_ = 1.0f; float main_window_width_default_ = 640; float main_window_height_default_ = 480; float main_window_width_ = 640; @@ -364,6 +368,10 @@ class Render { float stream_window_width_ = 1280; float stream_window_height_ = 720; SDL_PixelFormat stream_pixformat_ = SDL_PIXELFORMAT_NV12; + int stream_window_width_real_ = 1280; + int stream_window_height_real_ = 720; + float stream_window_dpi_scaling_w_ = 1.0f; + float stream_window_dpi_scaling_h_ = 1.0f; bool label_inited_ = false; bool connect_button_pressed_ = false;