Cleanup: move stride_round_up into the only place it is used.
[dcpomatic.git] / src / lib / util.cc
index d3af74376a3cd2349eeceafa9ab3ab35f5dc9423..6bcacf9f2bd3733dd09e1f2bafbdeeb100b8fb9e 100644 (file)
@@ -399,14 +399,14 @@ DCPOMATIC_ENABLE_WARNINGS
 #endif
 
        Pango::init ();
-       dcp::init (tags_path());
+       dcp::init (libdcp_resources_path());
 
 #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
        /* Render something to fontconfig to create its cache */
        list<StringText> subs;
        dcp::SubtitleString ss(
                optional<string>(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, dcp::Direction::LTR,
-               "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time()
+               "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0
                );
        subs.push_back (StringText(ss, 0));
        render_text (subs, list<shared_ptr<Font>>(), dcp::Size(640, 480), DCPTime(), 24);
@@ -529,18 +529,6 @@ digest_head_tail (vector<boost::filesystem::path> files, boost::uintmax_t size)
        return digester.get ();
 }
 
-/** Round a number up to the nearest multiple of another number.
- *  @param c Index.
- *  @param stride Array of numbers to round, indexed by c.
- *  @param t Multiple to round to.
- *  @return Rounded number.
- */
-int
-stride_round_up (int c, int const * stride, int t)
-{
-       int const a = stride[c] + (t - 1);
-       return a - (a % t);
-}
 
 /** Trip an assert if the caller is not in the UI thread */
 void
@@ -1111,7 +1099,7 @@ linear_to_db (double linear)
 
 
 dcp::Size
-scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container)
+scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta)
 {
        /* Now scale it down if the display container is smaller than the film container */
        if (display_container != film_container) {
@@ -1122,6 +1110,7 @@ scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_cont
 
                s.width = lrintf (s.width * scale);
                s.height = lrintf (s.height * scale);
+               s = quanta.round (s);
        }
 
        return s;