Fix order of calculations to make subtitle centering work after scaling (related...
authorCarl Hetherington <cth@carlh.net>
Mon, 26 Mar 2018 23:56:55 +0000 (00:56 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 26 Mar 2018 23:56:55 +0000 (00:56 +0100)
src/lib/player.cc

index 6ec593f6c8569e8d5a3d97e4efc113876b0587dd..44fe770ff0812a338ce2c251942a7fa385b31b01 100644 (file)
@@ -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()));