summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-02-18 19:39:23 +0000
committerCarl Hetherington <cth@carlh.net>2013-02-18 19:39:23 +0000
commit78ef2afb8e64fd0093b2f94b3f8246dba0a8058f (patch)
tree1c3304f241fed2eb8f567b27d74b620169e13eda /src
parent68f6efd164b0db1588513a8b8d3402eedb7bb86b (diff)
Fix subtitle positioning in the view, I think (#60).
Diffstat (limited to 'src')
-rw-r--r--src/lib/subtitle.cc4
-rw-r--r--src/wx/film_viewer.cc12
2 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/subtitle.cc b/src/lib/subtitle.cc
index bd5f0c879..5bb91af63 100644
--- a/src/lib/subtitle.cc
+++ b/src/lib/subtitle.cc
@@ -134,8 +134,8 @@ subtitle_transformed_area (
* Combining these two translations gives these expressions.
*/
- tx.x = target_x_scale * (sub_area.x + (sub_area.width * (1 - subtitle_scale) / 2));
- tx.y = target_y_scale * (sub_area.y + (sub_area.height * (1 - subtitle_scale) / 2));
+ tx.x = rint (target_x_scale * (sub_area.x + (sub_area.width * (1 - subtitle_scale) / 2)));
+ tx.y = rint (target_y_scale * (sub_area.y + (sub_area.height * (1 - subtitle_scale) / 2)));
return tx;
}
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index e9992a11f..96656ce09 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -149,7 +149,6 @@ FilmViewer::set_film (shared_ptr<Film> f)
_film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));
film_changed (Film::CONTENT);
- film_changed (Film::CROP);
film_changed (Film::FORMAT);
film_changed (Film::WITH_SUBTITLES);
film_changed (Film::SUBTITLE_OFFSET);
@@ -289,9 +288,16 @@ FilmViewer::raw_to_display ()
}
if (_raw_sub) {
+
+ /* Our output is already cropped by the decoder, so we need to account for that
+ when working out the scale that we are applying.
+ */
+
+ Size const cropped_size = _film->cropped_size (_film->size ());
+
Rect tx = subtitle_transformed_area (
- float (_film_size.width) / _film->size().width,
- float (_film_size.height) / _film->size().height,
+ float (_film_size.width) / cropped_size.width,
+ float (_film_size.height) / cropped_size.height,
_raw_sub->area(), _film->subtitle_offset(), _film->subtitle_scale()
);