X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Fgl_video_view.cc;h=640b6a373a6d0fe2b1e4f631d4f985a1d4f093c6;hp=5d9f2742fa6b165ed94b611b6464cab94b4f0d96;hb=89aaf8225c9a6ca079317b248039fba103e8d4a3;hpb=1b6b469e927de081367b9cf861f0a551ee43422b diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 5d9f2742f..640b6a373 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -30,12 +30,13 @@ #include "film_viewer.h" #include "wx_util.h" -#include "lib/image.h" +#include "lib/butler.h" +#include "lib/cross.h" #include "lib/dcpomatic_assert.h" +#include "lib/dcpomatic_log.h" #include "lib/exceptions.h" -#include "lib/cross.h" +#include "lib/image.h" #include "lib/player_video.h" -#include "lib/butler.h" #include #include @@ -103,12 +104,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; @@ -622,7 +626,7 @@ GLVideoView::set_image (shared_ptr pv) glBufferSubData (GL_ARRAY_BUFFER, 0, video.size(), video.vertices()); check_gl_error ("glBufferSubData (video)"); - const auto border = Rectangle(canvas_size, inter_position.x, inter_position.y, inter_size); + const auto border = Rectangle(canvas_size, inter_position.x + x_offset, inter_position.y + y_offset, inter_size); glBufferSubData (GL_ARRAY_BUFFER, 8 * 5 * sizeof(float), border.size(), border.vertices()); check_gl_error ("glBufferSubData (border)"); } @@ -695,7 +699,11 @@ GLVideoView::set_image_and_draw () auto pv = player_video().first; if (pv) { set_image (pv); - draw (); + } + + draw (); + + if (pv) { _viewer->image_changed (pv); } }