Only build FrameRateChange description when required, not every time one is constructed.
authorCarl Hetherington <cth@carlh.net>
Sat, 9 Aug 2014 12:07:55 +0000 (13:07 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 9 Aug 2014 12:07:55 +0000 (13:07 +0100)
src/lib/frame_rate_change.cc
src/lib/frame_rate_change.h
src/wx/video_panel.cc

index 454938ada3d5043de1e983b28b40be7c2a057dd5..31fce6b6d71182625ebc0a43bc4609d1e7f5ab8c 100644 (file)
@@ -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;
 }
index f53adc05925c1dea9fa461a491c54f2c111b6f23..f5244fea2b5d68491039b5c52db71d4ca81dd35f 100644 (file)
@@ -60,7 +60,7 @@ struct FrameRateChange
         */
        float speed_up;
 
-       std::string description;
+       std::string description () const;
 };
 
 #endif
index 2d874b9594e8997571516d805d3d396df253b366..fcb1b9f806069babf0f2032ae01a8ba1adf035b6 100644 (file)
@@ -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) {