From: Carl Hetherington Date: Sun, 7 Apr 2013 16:50:35 +0000 (+0100) Subject: Hopefully fix lack of background redraw of film viewer on Windows (#86). X-Git-Tag: v2.0.48~1337^2~347^2~99 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=fb55f810414893a1bad62abd03e5202aa42028c1;p=dcpomatic.git Hopefully fix lack of background redraw of film viewer on Windows (#86). --- diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 69f09c880..eb36ce1ff 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -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); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 08eade4d0..4dca5cad8 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -54,7 +54,6 @@ FilmViewer::FilmViewer (shared_ptr 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 input = _raw_frame; pair 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 diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 456301eb4..f89269d2b 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -80,6 +80,4 @@ private: libdcp::Size _film_size; /** Size of the panel that we have available */ libdcp::Size _panel_size; - - bool _clear_required; };