Remove unused RGBPlusAlphaImage; merge Image/SimpleImage.
[dcpomatic.git] / src / wx / film_viewer.cc
index 6d7181b5fae3a74f3a6165f5c937747629489620..2cc63aea4da7d0e5185c010b9485fd893cadfc8c 100644 (file)
@@ -67,9 +67,7 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        _panel->SetDoubleBuffered (true);
 #endif
        
-#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
        _panel->SetBackgroundStyle (wxBG_STYLE_PAINT);
-#endif 
        
        _v_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (_v_sizer);
@@ -131,6 +129,7 @@ FilmViewer::set_film (shared_ptr<Film> f)
        _player->Video.connect (boost::bind (&FilmViewer::process_video, this, _1, _2, _3));
        _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this));
 
+       calculate_sizes ();
        fetch_current_frame_again ();
 }
 
@@ -141,7 +140,9 @@ FilmViewer::fetch_current_frame_again ()
                return;
        }
 
-       _player->seek (_player->video_position() - _film->video_frames_to_time (1), false);
+       Time const t = _film->video_frames_to_time (1);
+       
+       _player->seek (_player->video_position() - t * 1.5, true);
        fetch_next_frame ();
 }
 
@@ -173,7 +174,7 @@ FilmViewer::paint_panel (wxPaintEvent &)
                return;
        }
 
-       shared_ptr<SimpleImage> packed_frame (new SimpleImage (_frame, false));
+       shared_ptr<Image> packed_frame (new Image (_frame, false));
 
        wxImage frame (_out_size.width, _out_size.height, packed_frame->data()[0], true);
        wxBitmap frame_bitmap (frame);
@@ -211,6 +212,7 @@ FilmViewer::panel_sized (wxSizeEvent& ev)
 {
        _panel_size.width = ev.GetSize().GetWidth();
        _panel_size.height = ev.GetSize().GetHeight();
+       calculate_sizes ();
        fetch_current_frame_again ();
 }
 
@@ -273,7 +275,7 @@ FilmViewer::process_video (shared_ptr<const Image> image, bool, Time t)
        double const fps = _film->dcp_video_frame_rate ();
        /* Count frame number from 1 ... not sure if this is the best idea */
        _frame_number->SetLabel (wxString::Format (wxT("%d"), int (rint (t * fps / TIME_HZ)) + 1));
-
+       
        double w = static_cast<double>(t) / TIME_HZ;
        int const h = (w / 3600);
        w -= h * 3600;
@@ -298,7 +300,7 @@ FilmViewer::fetch_next_frame ()
 
        try {
                _got_frame = false;
-               while (!_got_frame && !_player->pass ());
+               while (!_got_frame && !_player->pass ()) {}
        } catch (DecodeError& e) {
                _play_button->SetValue (false);
                check_play_state ();