From e7d33e47910f9e9e9846d284314a0dfd79265b1e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 27 Mar 2018 00:56:55 +0100 Subject: [PATCH] Fix order of calculations to make subtitle centering work after scaling (related to #1246). --- src/lib/player.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/player.cc b/src/lib/player.cc index 6ec593f6c..44fe770ff 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -862,14 +862,14 @@ Player::image_subtitle_start (weak_ptr wp, ContentImageSubtitle subtitle) subtitle.sub.rectangle.x += piece->content->subtitle->x_offset (); subtitle.sub.rectangle.y += piece->content->subtitle->y_offset (); + /* Apply a corrective translation to keep the subtitle centred after the scale that is coming up */ + subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * ((piece->content->subtitle->x_scale() - 1) / 2); + subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * ((piece->content->subtitle->y_scale() - 1) / 2); + /* Apply content's subtitle scale */ subtitle.sub.rectangle.width *= piece->content->subtitle->x_scale (); subtitle.sub.rectangle.height *= piece->content->subtitle->y_scale (); - /* Apply a corrective translation to keep the subtitle centred after that scale */ - subtitle.sub.rectangle.x -= subtitle.sub.rectangle.width * (piece->content->subtitle->x_scale() - 1); - subtitle.sub.rectangle.y -= subtitle.sub.rectangle.height * (piece->content->subtitle->y_scale() - 1); - PlayerSubtitles ps; ps.image.push_back (subtitle.sub); DCPTime from (content_time_to_dcp (piece, subtitle.from())); -- 2.30.2