From: Carl Hetherington Date: Thu, 9 Sep 2021 19:06:31 +0000 (+0200) Subject: Remove unnecessary _out_size; it looks like we can just use the image size. X-Git-Tag: v2.15.163~1^2~27 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=7bebe412366e9156aa908d054d9fa210cc370f92;ds=sidebyside Remove unnecessary _out_size; it looks like we can just use the image size. --- diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index c7e154fa5..a3c015ab1 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -281,21 +281,22 @@ FilmViewer::calculate_sizes () auto const view_ratio = float(_video_view->get()->GetSize().x) / _video_view->get()->GetSize().y; auto const film_ratio = container ? container->ratio () : 1.78; + dcp::Size out_size; if (view_ratio < film_ratio) { /* panel is less widscreen than the film; clamp width */ - _out_size.width = _video_view->get()->GetSize().x; - _out_size.height = lrintf (_out_size.width / film_ratio); + out_size.width = _video_view->get()->GetSize().x; + out_size.height = lrintf (out_size.width / film_ratio); } else { /* panel is more widescreen than the film; clamp height */ - _out_size.height = _video_view->get()->GetSize().y; - _out_size.width = lrintf (_out_size.height * film_ratio); + out_size.height = _video_view->get()->GetSize().y; + out_size.width = lrintf (out_size.height * film_ratio); } /* Catch silly values */ - _out_size.width = max (64, _out_size.width); - _out_size.height = max (64, _out_size.height); + out_size.width = max (64, out_size.width); + out_size.height = max (64, out_size.height); - _player->set_video_container_size (_out_size); + _player->set_video_container_size (out_size); } diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 2efe448c9..ef5ce41c9 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -115,9 +115,6 @@ public: } /* Some accessors and utility methods that VideoView classes need */ - dcp::Size out_size () const { - return _out_size; - } bool outline_content () const { return _outline_content; } @@ -176,9 +173,6 @@ private: bool _coalesce_player_changes = false; std::vector _pending_player_changes; - /** Size of our output (including padding if we have any) */ - dcp::Size _out_size; - RtAudio _audio; int _audio_channels = 0; unsigned int _audio_block_size = 1024; diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index f5499ad9d..5dd47ce4c 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -63,12 +63,13 @@ SimpleVideoView::paint () _state_timer.set("paint-panel"); wxPaintDC dc (_panel); - dcp::Size const out_size = _viewer->out_size (); - wxSize const panel_size = _panel->GetSize (); + auto const panel_size = _panel->GetSize (); - if (!out_size.width || !out_size.height || !_image || out_size != _image->size()) { + dcp::Size out_size; + if (!_image) { dc.Clear (); } else { + out_size = _image->size(); wxImage frame (out_size.width, out_size.height, _image->data()[0], true); wxBitmap frame_bitmap (frame); dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));