Use the correct font to render subtitles in preview / burn-in (#663).
[dcpomatic.git] / src / lib / j2k_image_proxy.cc
index 7dca3d8a9faca7324e49a5bbc32a3c4b2008d6b1..9914887738bc5859eba5a21eec55e88f15ee56db 100644 (file)
@@ -35,6 +35,7 @@ using std::string;
 using std::cout;
 using boost::shared_ptr;
 using boost::optional;
+using boost::dynamic_pointer_cast;
 
 /** Construct a J2KImageProxy from a JPEG2000 file */
 J2KImageProxy::J2KImageProxy (boost::filesystem::path path, dcp::Size size)
@@ -111,7 +112,7 @@ J2KImageProxy::image (optional<dcp::NoteHandler> note) const
        } else {
                dcp::xyz_to_rgb (oj, dcp::ColourConversion::srgb_to_xyz(), image->data()[0], image->stride()[0], note);
        }
-       
+
        return image;
 }
 
@@ -132,3 +133,18 @@ J2KImageProxy::send_binary (shared_ptr<Socket> socket) const
 {
        socket->write (_data.data().get(), _data.size());
 }
+
+bool
+J2KImageProxy::same (shared_ptr<const ImageProxy> other) const
+{
+       shared_ptr<const J2KImageProxy> jp = dynamic_pointer_cast<const J2KImageProxy> (other);
+       if (!jp) {
+               return false;
+       }
+
+       if (_data.size() != jp->_data.size()) {
+               return false;
+       }
+
+       return memcmp (_data.data().get(), jp->_data.data().get(), _data.size()) == 0;
+}