diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-09-02 03:12:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-09-02 03:12:43 +0100 |
| commit | 63a1ada934c258dfa60a92f7a406b084531856d9 (patch) | |
| tree | 996c7811d315cd437871de0a4270a40079fdc1af /src | |
| parent | 64e7d484e2a481ff87fc6d80f092c310c3eae67e (diff) | |
Remove unnecessary subtitle scale (I think).
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/player.cc | 53 | ||||
| -rw-r--r-- | src/lib/player.h | 1 |
2 files changed, 18 insertions, 36 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index 12c03e306..15f274e98 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -307,39 +307,6 @@ Player::film_change (ChangeType type, Film::Property p) } } -list<PositionImage> -Player::transform_bitmap_texts (list<BitmapText> subs) const -{ - list<PositionImage> all; - - for (list<BitmapText>::const_iterator i = subs.begin(); i != subs.end(); ++i) { - if (!i->image) { - continue; - } - - /* We will scale the subtitle up to fit _video_container_size */ - dcp::Size scaled_size (i->rectangle.width * _video_container_size.width, i->rectangle.height * _video_container_size.height); - - all.push_back ( - PositionImage ( - i->image->scale ( - scaled_size, - dcp::YUV_TO_RGB_REC601, - i->image->pixel_format (), - true, - _fast - ), - Position<int> ( - lrint (_video_container_size.width * i->rectangle.x), - lrint (_video_container_size.height * i->rectangle.y) - ) - ) - ); - } - - return all; -} - shared_ptr<PlayerVideo> Player::black_player_video_frame (Eyes eyes) const { @@ -714,8 +681,24 @@ Player::open_subtitles_for_frame (DCPTime time) const ) { /* Bitmap subtitles */ - list<PositionImage> c = transform_bitmap_texts (j.bitmap); - copy (c.begin(), c.end(), back_inserter (captions)); + BOOST_FOREACH (BitmapText i, j.bitmap) { + if (!i.image) { + continue; + } + + /* i.image will already have been scaled to fit _video_container_size */ + dcp::Size scaled_size (i.rectangle.width * _video_container_size.width, i.rectangle.height * _video_container_size.height); + + captions.push_back ( + PositionImage ( + i.image, + Position<int> ( + lrint (_video_container_size.width * i.rectangle.x), + lrint (_video_container_size.height * i.rectangle.y) + ) + ) + ); + } /* String subtitles (rendered to an image) */ if (!j.string.empty ()) { diff --git a/src/lib/player.h b/src/lib/player.h index 70a2e4ae3..95547f61c 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -115,7 +115,6 @@ private: void film_change (ChangeType, Film::Property); void playlist_change (ChangeType); void playlist_content_change (ChangeType, int, bool); - std::list<PositionImage> transform_bitmap_texts (std::list<BitmapText>) const; Frame dcp_to_content_video (boost::shared_ptr<const Piece> piece, DCPTime t) const; DCPTime content_video_to_dcp (boost::shared_ptr<const Piece> piece, Frame f) const; Frame dcp_to_resampled_audio (boost::shared_ptr<const Piece> piece, DCPTime t) const; |
