Fix failure to update peak on changing gain (#2286).
[dcpomatic.git] / src / wx / simple_video_view.cc
index 1ac56bbfe1f0ca3af029b6840511124af242a630..00d81ab47a4d89f89e552b55ab017348e7220363 100644 (file)
 #include "lib/dcpomatic_log.h"
 #include "lib/image.h"
 #include <dcp/util.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
 #include <boost/bind/bind.hpp>
 
 
@@ -65,11 +68,16 @@ SimpleVideoView::paint ()
 {
         _state_timer.set("paint-panel");
        wxPaintDC dc (_panel);
+       auto scale = 1 / dpi_scale_factor (_panel);
+       dc.SetLogicalScale (scale, scale);
 
        auto const panel_size = _panel->GetSize ();
+       auto pad = pad_colour();
 
        dcp::Size out_size;
        if (!_image) {
+               wxBrush b (pad);
+               dc.SetBackground (b);
                dc.Clear ();
        } else {
                DCPOMATIC_ASSERT (_image->alignment() == Image::Alignment::COMPACT);
@@ -79,8 +87,6 @@ SimpleVideoView::paint ()
                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()) {
                wxPen   p (pad);
                wxBrush b (pad);
@@ -114,6 +120,19 @@ SimpleVideoView::paint ()
                dc.DrawRectangle (subs->x * out_size.width, subs->y * out_size.height, subs->width * out_size.width, subs->height * out_size.height);
        }
 
+       if (_viewer->crop_guess()) {
+               wxPen p (crop_guess_colour(), 2);
+               dc.SetPen (p);
+               dc.SetBrush (*wxTRANSPARENT_BRUSH);
+               auto const crop_guess = _viewer->crop_guess().get();
+               dc.DrawRectangle (
+                       _inter_position.x + _inter_size.width * crop_guess.x,
+                       _inter_position.y + _inter_size.height * crop_guess.y,
+                       _inter_size.width * crop_guess.width,
+                       _inter_size.height * crop_guess.height
+                       );
+       }
+
         _state_timer.unset();
 }
 
@@ -222,7 +241,7 @@ SimpleVideoView::update ()
 
        _state_timer.set ("get image");
 
-       _image = player_video().first->image(bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, true);
+       _image = player_video().first->image(boost::bind(&PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, true);
 
        _state_timer.set ("ImageChanged");
        _viewer->image_changed (player_video().first);