From 6e52f83418c64d5cbd0e613a5fc96ea32881d4d9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 16 Jun 2013 15:52:32 +0100 Subject: Fix subtitle controls in the viewer. --- src/lib/video_decoder.cc | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src/lib/video_decoder.cc') diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index 58aceb407..54d14e2c6 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -61,20 +61,22 @@ VideoDecoder::video (shared_ptr image, bool same, Time t) shared_ptr out = image->scale_and_convert_to_rgb (image_size, film->scaler(), true); - shared_ptr sub; - if (_timed_subtitle && _timed_subtitle->displayed_at (t)) { - sub = _timed_subtitle->subtitle (); - } - - if (sub) { - dcpomatic::Rect const tx = subtitle_transformed_area ( - float (image_size.width) / video_size().width, - float (image_size.height) / video_size().height, - sub->area(), film->subtitle_offset(), film->subtitle_scale() - ); - - shared_ptr im = sub->image()->scale (tx.size(), film->scaler(), true); - out->alpha_blend (im, tx.position()); + if (film->with_subtitles ()) { + shared_ptr sub; + if (_timed_subtitle && _timed_subtitle->displayed_at (t)) { + sub = _timed_subtitle->subtitle (); + } + + if (sub) { + dcpomatic::Rect const tx = subtitle_transformed_area ( + float (image_size.width) / video_size().width, + float (image_size.height) / video_size().height, + sub->area(), film->subtitle_offset(), film->subtitle_scale() + ); + + shared_ptr im = sub->image()->scale (tx.size(), film->scaler(), true); + out->alpha_blend (im, tx.position()); + } } if (image_size != container_size) { -- cgit v1.2.3