Remove unnecessary _out_size; it looks like we can just use the image size.
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Sep 2021 19:06:31 +0000 (21:06 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 27 Sep 2021 11:41:46 +0000 (13:41 +0200)
src/wx/film_viewer.cc
src/wx/film_viewer.h
src/wx/simple_video_view.cc

index c7e154fa53597bf340bb4337cc32af6174bb8159..a3c015ab197299d0225408906026316f19e781a5 100644 (file)
@@ -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);
 }
 
 
index 2efe448c9e4deeaa37ba58e73e1511cf3ae48ee8..ef5ce41c925d2e535204c9c0d9fd441f02791829 100644 (file)
@@ -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<int> _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;
index f5499ad9d4f6b93aa27113f7ed8d19992acd1abe..5dd47ce4c2d545d8716a541b35156e733d00c606 100644 (file)
@@ -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));