From 17f8f22b07bd32d57edada0acde6fd9fffe3baf3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 4 Mar 2024 00:41:01 +0100 Subject: More correctly calculate bitmap subtitle scaling (#2670). This was partially fixed before in 6ac468554c7fea0dfaefde85fb6cdd0fceaf5cad The last try accounted for cropping, but not for cases where the source video (after crop) does not precisely fit the DCP container. In those cases the x scale for the subtitles could be different to the y scale, squashing or stretching them. --- src/lib/bitmap_text.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/bitmap_text.h') diff --git a/src/lib/bitmap_text.h b/src/lib/bitmap_text.h index 04cb61e3e..50f3f507a 100644 --- a/src/lib/bitmap_text.h +++ b/src/lib/bitmap_text.h @@ -23,6 +23,7 @@ #include "rect.h" +#include #include @@ -31,11 +32,14 @@ class Image; class BitmapText { public: - BitmapText(std::shared_ptr image_, dcpomatic::Rect rectangle_) - : image(image_) + BitmapText(dcp::Size parent_size_, std::shared_ptr image_, dcpomatic::Rect rectangle_) + : parent_size(parent_size_) + , image(image_) , rectangle(rectangle_) {} + /** Size of the image that this subtitle has come from, with any crop already applied */ + dcp::Size parent_size; std::shared_ptr image; /** Area that the subtitle covers on its corresponding video, expressed in * proportions of the image size; e.g. rectangle.x = 0.5 would mean that -- cgit v1.2.3