Fix for HiDPI scaling of videos (#2)

This commit is contained in:
Pierre Jeanjean 2020-11-24 19:31:23 +01:00 committed by GitHub
parent dc9d9beec5
commit fbcca085c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -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());