More correctly calculate bitmap subtitle scaling (#2670).
[dcpomatic.git] / src / lib / bitmap_text.h
index b8861c10a651986795a57e0cdca5f6aa914dbad0..50f3f507ad6cd9393bd3581e62e6d7f81cfe1446 100644 (file)
@@ -23,6 +23,7 @@
 
 
 #include "rect.h"
+#include <dcp/types.h>
 #include <memory>
 
 
@@ -31,12 +32,15 @@ class Image;
 class BitmapText
 {
 public:
-       BitmapText (std::shared_ptr<Image> i, dcpomatic::Rect<double> r)
-               : image (i)
-               , rectangle (r)
+       BitmapText(dcp::Size parent_size_, std::shared_ptr<const Image> image_, dcpomatic::Rect<double> rectangle_)
+               : parent_size(parent_size_)
+               , image(image_)
+               , rectangle(rectangle_)
        {}
 
-       std::shared_ptr<Image> image;
+       /** Size of the image that this subtitle has come from, with any crop already applied */
+       dcp::Size parent_size;
+       std::shared_ptr<const Image> 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
         *  the rectangle starts half-way across the video.