Extent black_image() to make images of any size.
authorCarl Hetherington <cth@carlh.net>
Sun, 13 Dec 2020 20:22:30 +0000 (21:22 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 17 Jan 2021 19:13:22 +0000 (20:13 +0100)
test/test.cc
test/test.h

index af005e50ce9deb16856e0808b285cf1063bcbc3f..8092df4f52919ed55831c056cc8bfb2564941a9f 100644 (file)
@@ -448,10 +448,10 @@ make_simple_with_smpte_ccaps (boost::filesystem::path path)
 
 
 shared_ptr<dcp::OpenJPEGImage>
-black_image ()
+black_image (dcp::Size size)
 {
-       shared_ptr<dcp::OpenJPEGImage> image(new dcp::OpenJPEGImage(dcp::Size(1998, 1080)));
-       int const pixels = 1998 * 1080;
+       shared_ptr<dcp::OpenJPEGImage> image(new dcp::OpenJPEGImage(size));
+       int const pixels = size.width * size.height;
        for (int i = 0; i < 3; ++i) {
                memset (image->data(i), 0, pixels * sizeof(int));
        }
index 1368973a65c44df69bf370454736e730f152c8e3..1d9cd9215f6ac77a5b6dd8204bc2d821ca1088d2 100644 (file)
@@ -50,7 +50,7 @@ extern std::shared_ptr<dcp::DCP> make_simple_with_interop_subs (boost::filesyste
 extern std::shared_ptr<dcp::DCP> make_simple_with_smpte_subs (boost::filesystem::path path);
 extern std::shared_ptr<dcp::DCP> make_simple_with_interop_ccaps (boost::filesystem::path path);
 extern std::shared_ptr<dcp::DCP> make_simple_with_smpte_ccaps (boost::filesystem::path path);
-extern std::shared_ptr<dcp::OpenJPEGImage> black_image ();
+extern std::shared_ptr<dcp::OpenJPEGImage> black_image (dcp::Size size = dcp::Size(1998, 1080));
 extern std::shared_ptr<dcp::ReelAsset> black_picture_asset (boost::filesystem::path dir, int frames = 24);
 
 /** Creating an object of this class will make asdcplib's random number generation