summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-03-27 00:56:55 +0100
committerCarl Hetherington <cth@carlh.net>2018-03-27 00:56:55 +0100
commite7d33e47910f9e9e9846d284314a0dfd79265b1e (patch)
tree353aa7283a54113ed86b456a4d3a3535fdbb6cb4
parentff19a446391f6a1d379689d52a0ac33a2af250df (diff)
Fix order of calculations to make subtitle centering work after scaling (related to #1246).
-rw-r--r--src/lib/player.cc8
1 files 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<Piece> 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()));