Fix bit chopped off right hand side of video waveform.
authorCarl Hetherington <cth@carlh.net>
Tue, 16 Aug 2016 12:26:57 +0000 (13:26 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 Aug 2016 12:26:57 +0000 (13:26 +0100)
src/wx/video_waveform_plot.cc
src/wx/video_waveform_plot.h

index eb2cf97c6d72b4c6f65fd431f2b7ddd9a7a871d0..e2083caa632b230ef1c33c6e59761dcda2befe9f 100644 (file)
@@ -38,6 +38,7 @@ using boost::shared_ptr;
 using dcp::locale_convert;
 
 int const VideoWaveformPlot::_vertical_margin = 8;
+int const VideoWaveformPlot::_x_axis_width = 52;
 
 VideoWaveformPlot::VideoWaveformPlot (wxWindow* parent, FilmViewer* viewer)
        : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)
@@ -78,7 +79,6 @@ VideoWaveformPlot::paint ()
                return;
        }
 
-       int const axis_x = 48;
        int const height = _waveform->size().height;
 
        gc->SetPen (wxPen (wxColour (255, 255, 255), 1, wxPENSTYLE_SOLID));
@@ -108,7 +108,7 @@ VideoWaveformPlot::paint ()
                wxGraphicsPath p = gc->CreatePath ();
                int const y = _vertical_margin + height - (i * height / label_gaps) - 1;
                p.MoveToPoint (label_width + 8, y);
-               p.AddLineToPoint (axis_x, y);
+               p.AddLineToPoint (_x_axis_width - 4, y);
                gc->StrokePath (p);
                int x = 4;
                int const n = i * 4096 / label_gaps;
@@ -124,7 +124,7 @@ VideoWaveformPlot::paint ()
 
        wxImage waveform (_waveform->size().width, height, _waveform->data()[0], true);
        wxBitmap bitmap (waveform);
-       gc->DrawBitmap (bitmap, axis_x + 4, _vertical_margin, _waveform->size().width, height);
+       gc->DrawBitmap (bitmap, _x_axis_width, _vertical_margin, _waveform->size().width, height);
 
        delete gc;
 }
@@ -166,7 +166,7 @@ VideoWaveformPlot::create_waveform ()
        }
 
        _waveform = _waveform->scale (
-               dcp::Size (GetSize().GetWidth() - 32, waveform_height),
+               dcp::Size (GetSize().GetWidth() - _x_axis_width, waveform_height),
                dcp::YUV_TO_RGB_REC709, AV_PIX_FMT_RGB24, false, false
                );
 }
index c5cc498f6273a07bcf3e1482b258ee620762180f..0f8bd33cdb9c329d17ec1d518d737fe8fea55466 100644 (file)
@@ -54,6 +54,7 @@ private:
        int _contrast;
 
        static int const _vertical_margin;
+       static int const _x_axis_width;
 
        boost::signals2::connection _viewer_connection;
 };