diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-08-09 13:07:55 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-08-09 13:07:55 +0100 |
| commit | fdf4bfbca898ba5401a6853f481968d15b6ebded (patch) | |
| tree | 7cf3b82cc9a7969fee111017b208b5ee6d419944 /src | |
| parent | 9a3bb0784f7cd1011e071eeea53b30f15c8dbe3c (diff) | |
Only build FrameRateChange description when required, not every time one is constructed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/frame_rate_change.cc | 10 | ||||
| -rw-r--r-- | src/lib/frame_rate_change.h | 2 | ||||
| -rw-r--r-- | src/wx/video_panel.cc | 2 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index 454938ada..31fce6b6d 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -23,6 +23,8 @@ #include "i18n.h" +using std::string; + static bool about_equal (float a, float b) { @@ -73,7 +75,13 @@ FrameRateChange::FrameRateChange (float source_, int dcp_) speed_up = dcp / (source * factor()); change_speed = !about_equal (speed_up, 1.0); +} +string +FrameRateChange::description () const +{ + string description; + if (!skip && repeat == 1 && !change_speed) { description = _("Content and DCP have the same rate.\n"); } else { @@ -90,4 +98,6 @@ FrameRateChange::FrameRateChange (float source_, int dcp_) description += String::compose (_("DCP will run at %1%% of the content speed.\n"), pc); } } + + return description; } diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h index f53adc059..f5244fea2 100644 --- a/src/lib/frame_rate_change.h +++ b/src/lib/frame_rate_change.h @@ -60,7 +60,7 @@ struct FrameRateChange */ float speed_up; - std::string description; + std::string description () const; }; #endif diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 2d874b959..fcb1b9f80 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -332,7 +332,7 @@ VideoPanel::setup_description () d << wxString::Format (_("Content frame rate %.4f\n"), vcs->video_frame_rate ()); ++lines; FrameRateChange frc (vcs->video_frame_rate(), _editor->film()->video_frame_rate ()); - d << std_to_wx (frc.description) << "\n"; + d << std_to_wx (frc.description ()) << "\n"; ++lines; for (int i = lines; i < 6; ++i) { |
