Hopefully fix lack of background redraw of film viewer on Windows (#86).
authorCarl Hetherington <cth@carlh.net>
Sun, 7 Apr 2013 16:50:35 +0000 (17:50 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 7 Apr 2013 17:10:53 +0000 (18:10 +0100)
src/wx/film_editor.cc
src/wx/film_viewer.cc
src/wx/film_viewer.h

index 69f09c8800c388f86cf908cec39d0d00684571c9..eb36ce1ff26087e9fb45ef74bff66709fcc4df18 100644 (file)
@@ -148,7 +148,7 @@ FilmEditor::make_film_panel ()
        }
        ++r;
 
-       _frame_rate_description = new wxStaticText (_film_panel, wxID_ANY, wxT (" \n "), wxDefaultPosition, wxDefaultSize);
+       _frame_rate_description = new wxStaticText (_film_panel, wxID_ANY, wxT (" \n \n "), wxDefaultPosition, wxDefaultSize);
        grid->Add (video_control (_frame_rate_description), wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
        wxFont font = _frame_rate_description->GetFont();
        font.SetStyle(wxFONTSTYLE_ITALIC);
index 08eade4d0f020d59916c6ec12b4a8d78b9f4a3a7..4dca5cad85223f17e26ea1cc541fa76c0c2ea76b 100644 (file)
@@ -54,7 +54,6 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        , _play_button (new wxToggleButton (this, wxID_ANY, _("Play")))
        , _display_frame_x (0)
        , _got_frame (false)
-       , _clear_required (false)
 {
        _panel->SetDoubleBuffered (true);
 #if wxMAJOR_VERSION == 2 && wxMINOR_VERSION >= 9
@@ -201,11 +200,6 @@ FilmViewer::paint_panel (wxPaintEvent &)
 {
        wxPaintDC dc (_panel);
 
-       if (_clear_required) {
-               dc.Clear ();
-               _clear_required = false;
-       }
-
        if (!_display_frame || !_film || !_out_size.width || !_out_size.height) {
                dc.Clear ();
                return;
@@ -227,6 +221,22 @@ FilmViewer::paint_panel (wxPaintEvent &)
                wxBitmap sub_bitmap (sub);
                dc.DrawBitmap (sub_bitmap, _display_sub_position.x, _display_sub_position.y);
        }
+
+       if (_film_size.width < _panel_size.width) {
+               wxPen p (GetBackgroundColour ());
+               wxBrush b (GetBackgroundColour ());
+               dc.SetPen (p);
+               dc.SetBrush (b);
+               dc.DrawRectangle (_film_size.width, 0, _panel_size.width - _film_size.width, _panel_size.height);
+       }
+
+       if (_film_size.height < _panel_size.height) {
+               wxPen p (GetBackgroundColour ());
+               wxBrush b (GetBackgroundColour ());
+               dc.SetPen (p);
+               dc.SetBrush (b);
+               dc.DrawRectangle (0, _film_size.height, _panel_size.width, _panel_size.height - _film_size.height);
+       }               
 }
 
 
@@ -275,11 +285,6 @@ FilmViewer::raw_to_display ()
                return;
        }
 
-       libdcp::Size old_size;
-       if (_display_frame) {
-               old_size = _display_frame->size();
-       }
-
        boost::shared_ptr<Image> input = _raw_frame;
 
        pair<string, string> const s = Filter::ffmpeg_strings (_film->filters());
@@ -290,10 +295,6 @@ FilmViewer::raw_to_display ()
        /* Get a compacted image as we have to feed it to wxWidgets */
        _display_frame = input->scale_and_convert_to_rgb (_film_size, 0, _film->scaler(), false);
 
-       if (old_size != _display_frame->size()) {
-               _clear_required = true;
-       }
-
        if (_raw_sub) {
 
                /* Our output is already cropped by the decoder, so we need to account for that
index 456301eb4e0744d9162e60781e7034bf2ad90c4b..f89269d2b32c68ebe6762fbc64d51116bdf431a4 100644 (file)
@@ -80,6 +80,4 @@ private:
        libdcp::Size _film_size;
        /** Size of the panel that we have available */
        libdcp::Size _panel_size;
-
-       bool _clear_required;
 };