Account for DPI scale factors when calculating some sizes (#2118).
[dcpomatic.git] / src / wx / gl_video_view.cc
index ba6d1194cbdedc47bbbf4d7f6f8a3bf4143c4db4..a3e69a39be174c052d74ceb37df0da76f1589750 100644 (file)
@@ -103,12 +103,15 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
 void
 GLVideoView::size_changed (wxSizeEvent const& ev)
 {
-       _canvas_size = ev.GetSize ();
+       auto const scale = _canvas->GetDPIScaleFactor();
+       int const width = std::round(ev.GetSize().GetWidth() * scale);
+       int const height = std::round(ev.GetSize().GetHeight() * scale);
+       _canvas_size = { width, height };
+       LOG_GENERAL("GLVideoView canvas size changed to %1x%2", width, height);
        Sized ();
 }
 
 
-
 GLVideoView::~GLVideoView ()
 {
        boost::this_thread::disable_interruption dis;