X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fsimple_video_view.cc;h=5dd47ce4c2d545d8716a541b35156e733d00c606;hb=6cac49dc50dae6b173135df101d532f20031ca70;hp=342829471701f31bdee469a73ffd956d4e4a6dca;hpb=dd9be86db6cde0afa5da0d1d1ac43b42e05dca26;p=dcpomatic.git diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index 342829471..5dd47ce4c 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -63,30 +63,31 @@ 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)); } + auto pad = pad_colour(); + if (out_size.width < panel_size.GetWidth()) { - /* XXX: these colours are right for GNOME; may need adjusting for other OS */ - wxPen p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240)); - wxBrush b (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240)); + wxPen p (pad); + wxBrush b (pad); dc.SetPen (p); dc.SetBrush (b); dc.DrawRectangle (out_size.width, 0, panel_size.GetWidth() - out_size.width, panel_size.GetHeight()); } if (out_size.height < panel_size.GetHeight()) { - wxPen p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240)); - wxBrush b (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240)); + wxPen p (pad); + wxBrush b (pad); dc.SetPen (p); dc.SetBrush (b); int const gap = (panel_size.GetHeight() - out_size.height) / 2; @@ -95,15 +96,15 @@ SimpleVideoView::paint () } if (_viewer->outline_content()) { - wxPen p (wxColour (255, 0, 0), 2); + wxPen p (outline_content_colour(), 2); dc.SetPen (p); dc.SetBrush (*wxTRANSPARENT_BRUSH); dc.DrawRectangle (_inter_position.x, _inter_position.y + (panel_size.GetHeight() - out_size.height) / 2, _inter_size.width, _inter_size.height); } - optional > subs = _viewer->outline_subtitles(); + auto subs = _viewer->outline_subtitles(); if (subs) { - wxPen p (wxColour(0, 255, 0), 2); + wxPen p (outline_subtitles_colour(), 2); dc.SetPen (p); dc.SetBrush (*wxTRANSPARENT_BRUSH); dc.DrawRectangle (subs->x * out_size.width, subs->y * out_size.height, subs->width * out_size.width, subs->height * out_size.height); @@ -129,7 +130,7 @@ SimpleVideoView::timer () } display_next_frame (false); - DCPTime const next = position() + _viewer->one_video_frame(); + auto const next = position() + _viewer->one_video_frame(); if (next >= length()) { _viewer->finished (); @@ -159,7 +160,7 @@ SimpleVideoView::start () VideoView::NextFrameResult SimpleVideoView::display_next_frame (bool non_blocking) { - NextFrameResult const r = get_next_frame (non_blocking); + auto const r = get_next_frame (non_blocking); if (r != SUCCESS) { return r; } @@ -213,7 +214,7 @@ SimpleVideoView::update () _state_timer.set ("get image"); set_image ( - player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VIDEO_RANGE_FULL, false, true) + player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true) ); _state_timer.set ("ImageChanged");