From c7f45cd00b94393f6e15428a2ea256995f890412 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 26 Aug 2023 14:29:06 +0200 Subject: Cleanup: use some more vector instead of list. --- src/lib/player_text.h | 4 ++-- src/lib/render_text.cc | 24 ++++++++++++------------ src/lib/render_text.h | 6 +++--- src/lib/util.cc | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/lib') diff --git a/src/lib/player_text.h b/src/lib/player_text.h index 38affd5ef..5921b28f6 100644 --- a/src/lib/player_text.h +++ b/src/lib/player_text.h @@ -37,8 +37,8 @@ class PlayerText { public: /** BitmapTexts, with their rectangles transformed as specified by their content */ - std::list bitmap; - std::list string; + std::vector bitmap; + std::vector string; }; diff --git a/src/lib/render_text.cc b/src/lib/render_text.cc index 9d154feca..84fc8414d 100644 --- a/src/lib/render_text.cc +++ b/src/lib/render_text.cc @@ -39,7 +39,6 @@ LIBDCP_ENABLE_WARNINGS using std::cerr; using std::cout; -using std::list; using std::make_pair; using std::make_shared; using std::max; @@ -47,6 +46,7 @@ using std::min; using std::pair; using std::shared_ptr; using std::string; +using std::vector; using boost::optional; using namespace dcpomatic; @@ -76,7 +76,7 @@ create_layout(string font_name, string markup) string -marked_up (list subtitles, int target_height, float fade_factor, string font_name) +marked_up(vector subtitles, int target_height, float fade_factor, string font_name) { auto constexpr pixels_to_1024ths_point = 72 * 1024 / 96; @@ -296,7 +296,7 @@ struct Layout * at the same time and with the same fade in/out. */ static Layout -setup_layout(list subtitles, dcp::Size target, DCPTime time, int frame_rate) +setup_layout(vector subtitles, dcp::Size target, DCPTime time, int frame_rate) { DCPOMATIC_ASSERT(!subtitles.empty()); auto const& first = subtitles.front(); @@ -314,7 +314,7 @@ setup_layout(list subtitles, dcp::Size target, DCPTime time, int fra * at the same time and with the same fade in/out. */ static PositionImage -render_line (list subtitles, dcp::Size target, DCPTime time, int frame_rate) +render_line(vector subtitles, dcp::Size target, DCPTime time, int frame_rate) { /* XXX: this method can only handle italic / bold changes mid-line, nothing else yet. @@ -401,11 +401,11 @@ render_line (list subtitles, dcp::Size target, DCPTime time, int fra * @param target Size of the container that this subtitle will end up in. * @param frame_rate DCP frame rate. */ -list -render_text (list subtitles, dcp::Size target, DCPTime time, int frame_rate) +vector +render_text(vector subtitles, dcp::Size target, DCPTime time, int frame_rate) { - list pending; - list images; + vector pending; + vector images; for (auto const& i: subtitles) { if (!pending.empty() && (i.v_align() != pending.back().v_align() || fabs(i.v_position() - pending.back().v_position()) > 1e-4)) { @@ -423,11 +423,11 @@ render_text (list subtitles, dcp::Size target, DCPTime time, int fra } -list> -bounding_box(list subtitles, dcp::Size target, optional override_standard) +vector> +bounding_box(vector subtitles, dcp::Size target, optional override_standard) { - list pending; - list> rects; + vector pending; + vector> rects; auto use_pending = [&pending, &rects, target, override_standard]() { auto const& subtitle = pending.front(); diff --git a/src/lib/render_text.h b/src/lib/render_text.h index 6d20912a2..ff34dc10d 100644 --- a/src/lib/render_text.h +++ b/src/lib/render_text.h @@ -32,9 +32,9 @@ namespace dcpomatic { } -std::string marked_up (std::list subtitles, int target_height, float fade_factor, std::string font_name); -std::list render_text (std::list, dcp::Size, dcpomatic::DCPTime, int); -std::list> bounding_box(std::list subtitles, dcp::Size target, boost::optional override_standard = boost::none); +std::string marked_up(std::vector subtitles, int target_height, float fade_factor, std::string font_name); +std::vector render_text(std::vector, dcp::Size, dcpomatic::DCPTime, int); +std::vector> bounding_box(std::vector subtitles, dcp::Size target, boost::optional override_standard = boost::none); class FontMetrics diff --git a/src/lib/util.cc b/src/lib/util.cc index 05b69644f..4240279c6 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -461,7 +461,7 @@ LIBDCP_ENABLE_WARNINGS #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX) /* Render something to fontconfig to create its cache */ - list subs; + vector subs; dcp::SubtitleString ss( optional(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, 0, dcp::Direction::LTR, "Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0 -- cgit v1.2.3