+ update (film, video_container_size);
+}
+
+void
+Subtitle::update (shared_ptr<const Film> film, libdcp::Size video_container_size)
+{
+ shared_ptr<Piece> piece = _piece.lock ();
+ if (!piece) {
+ return;
+ }
+
+ if (!_in_image) {
+ _out_image.reset ();
+ return;
+ }
+
+ shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (piece->content);
+ assert (sc);
+
+ dcpomatic::Rect<double> in_rect = _in_rect;
+ libdcp::Size scaled_size;
+
+ in_rect.x += sc->subtitle_x_offset ();
+ in_rect.y += sc->subtitle_y_offset ();
+
+ /* We will scale the subtitle up to fit _video_container_size, and also by the additional subtitle_scale */
+ scaled_size.width = in_rect.width * video_container_size.width * sc->subtitle_scale ();
+ scaled_size.height = in_rect.height * video_container_size.height * sc->subtitle_scale ();
+
+ /* Then we need a corrective translation, consisting of two parts:
+ *
+ * 1. that which is the result of the scaling of the subtitle by _video_container_size; this will be
+ * rect.x * _video_container_size.width and rect.y * _video_container_size.height.
+ *
+ * 2. that to shift the origin of the scale by subtitle_scale to the centre of the subtitle; this will be
+ * (width_before_subtitle_scale * (1 - subtitle_scale) / 2) and
+ * (height_before_subtitle_scale * (1 - subtitle_scale) / 2).
+ *
+ * Combining these two translations gives these expressions.
+ */