Fix subtitle scaling when writing PNG subs.
authorCarl Hetherington <cth@carlh.net>
Sun, 2 Sep 2018 01:54:44 +0000 (02:54 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 2 Sep 2018 01:54:44 +0000 (02:54 +0100)
src/lib/player.cc

index b939995ef7bbaa7c5fdc6953be645da0fe803295..12c03e3066ad4c47ed311ee454f2c482c0eabe5e 100644 (file)
@@ -916,7 +916,10 @@ Player::bitmap_text_start (weak_ptr<Piece> wp, weak_ptr<const TextContent> wc, C
        subtitle.sub.rectangle.height *= text->y_scale ();
 
        PlayerText ps;
-       ps.bitmap.push_back (subtitle.sub);
+       shared_ptr<Image> image = subtitle.sub.image;
+       /* We will scale the subtitle up to fit _video_container_size */
+       dcp::Size scaled_size (subtitle.sub.rectangle.width * _video_container_size.width, subtitle.sub.rectangle.height * _video_container_size.height);
+       ps.bitmap.push_back (BitmapText(image->scale(scaled_size, dcp::YUV_TO_RGB_REC601, image->pixel_format(), true, _fast), subtitle.sub.rectangle));
        DCPTime from (content_time_to_dcp (piece, subtitle.from()));
 
        _active_texts[text->type()].add_from (wc, ps, from);