From fbcca085c3e45b109ba015c5fa0c7b47f9346329 Mon Sep 17 00:00:00 2001
From: Pierre Jeanjean <rhiobet@gmail.com>
Date: Tue, 24 Nov 2020 19:31:23 +0100
Subject: [PATCH] Fix for HiDPI scaling of videos (#2)

---
 src/video_display.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/video_display.cpp b/src/video_display.cpp
index 2df9ec3c0..494e62504 100644
--- a/src/video_display.cpp
+++ b/src/video_display.cpp
@@ -190,8 +190,12 @@ void VideoDisplay::Render() try {
 	if (!viewport_height || !viewport_width)
 		PositionVideo();
 
-	videoOut->Render(viewport_left, viewport_bottom, viewport_width, viewport_height);
-	E(glViewport(0, std::min(viewport_bottom, 0), videoSize.GetWidth(), videoSize.GetHeight()));
+	// Note: Right now, GetContentScaleFactor() always returns 1
+	// This should change with wxWidgets 3.2, and thus fix HiDPI scaling issues
+	videoOut->Render(viewport_left, viewport_bottom, viewport_width * GetContentScaleFactor(),
+			viewport_height * GetContentScaleFactor());
+	E(glViewport(0, std::min(viewport_bottom, 0), videoSize.GetWidth() * GetContentScaleFactor(),
+				videoSize.GetHeight() * GetContentScaleFactor()));
 
 	E(glMatrixMode(GL_PROJECTION));
 	E(glLoadIdentity());
-- 
GitLab