X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=f2d35fa2f7fc04c344de5620563e02df15a94872;hb=8eb951b71fa90e54c8da64e54cf5ddf6bf0809cf;hp=981cfa521eda35957eec466f8225f510f9c11506;hpb=3799e91d126d243d41c44dcb0ca1bfa66b53a57e;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index 981cfa521..f2d35fa2f 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -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 subs; dcp::SubtitleString ss( optional(), 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>(), dcp::Size(640, 480), DCPTime(), 24); @@ -529,18 +529,6 @@ digest_head_tail (vector 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 @@ -664,16 +652,6 @@ fit_ratio_within (float ratio, dcp::Size full_frame) return dcp::Size (full_frame.width, lrintf (full_frame.width / ratio)); } -void * -wrapped_av_malloc (size_t s) -{ - auto p = av_malloc (s); - if (!p) { - throw bad_alloc (); - } - return p; -} - map split_get_request (string url) { @@ -957,7 +935,7 @@ emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size { /* XXX: this is rather inefficient; decoding the image just to get its size */ FFmpegImageProxy proxy (sub.png_image()); - auto image = proxy.image(Image::Alignment::COMPACT).image; + auto image = proxy.image(Image::Alignment::PADDED).image; /* set up rect with height and width */ dcpomatic::Rect rect(0, 0, image->size().width / double(size.width), image->size().height / double(size.height)); @@ -1097,21 +1075,9 @@ copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::fun free (buffer); } -double -db_to_linear (double db) -{ - return pow(10, db / 20); -} - -double -linear_to_db (double linear) -{ - return 20 * log10(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 +1088,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;