diff options
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/test_image.cc')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/test_image.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/test_image.cc b/third_party/jpeg-xl/lib/jxl/test_image.cc index 098e9c25a1..42f028d53a 100644 --- a/third_party/jpeg-xl/lib/jxl/test_image.cc +++ b/third_party/jpeg-xl/lib/jxl/test_image.cc @@ -323,7 +323,7 @@ TestImage& TestImage::SetColorEncoding(const std::string& description) { } TestImage& TestImage::CoalesceGIFAnimationWithAlpha() { - extras::PackedFrame canvas = ppf_.frames[0].Copy(); + JXL_ASSIGN_OR_DIE(extras::PackedFrame canvas, ppf_.frames[0].Copy()); JXL_CHECK(canvas.color.format.num_channels == 3); JXL_CHECK(canvas.color.format.data_type == JXL_TYPE_UINT8); JXL_CHECK(canvas.extra_channels.size() == 1); @@ -331,7 +331,7 @@ TestImage& TestImage::CoalesceGIFAnimationWithAlpha() { const extras::PackedFrame& frame = ppf_.frames[i]; JXL_CHECK(frame.extra_channels.size() == 1); const JxlLayerInfo& layer_info = frame.frame_info.layer_info; - extras::PackedFrame rendered = canvas.Copy(); + JXL_ASSIGN_OR_DIE(extras::PackedFrame rendered, canvas.Copy()); uint8_t* pixels_rendered = reinterpret_cast<uint8_t*>(rendered.color.pixels()); const uint8_t* pixels_frame = @@ -353,7 +353,7 @@ TestImage& TestImage::CoalesceGIFAnimationWithAlpha() { } } if (layer_info.save_as_reference != 0) { - canvas = rendered.Copy(); + JXL_ASSIGN_OR_DIE(canvas, rendered.Copy()); } ppf_.frames[i] = std::move(rendered); } @@ -393,10 +393,14 @@ void TestImage::Frame::SetValue(size_t y, size_t x, size_t c, float val) { TestImage::Frame TestImage::AddFrame() { size_t index = ppf_.frames.size(); - extras::PackedFrame frame(ppf_.info.xsize, ppf_.info.ysize, format_); + JXL_ASSIGN_OR_DIE( + extras::PackedFrame frame, + extras::PackedFrame::Create(ppf_.info.xsize, ppf_.info.ysize, format_)); for (size_t i = 0; i < ppf_.extra_channels_info.size(); ++i) { JxlPixelFormat ec_format = {1, format_.data_type, format_.endianness, 0}; - extras::PackedImage image(ppf_.info.xsize, ppf_.info.ysize, ec_format); + JXL_ASSIGN_OR_DIE(extras::PackedImage image, + extras::PackedImage::Create(ppf_.info.xsize, + ppf_.info.ysize, ec_format)); frame.extra_channels.emplace_back(std::move(image)); } ppf_.frames.emplace_back(std::move(frame)); @@ -404,10 +408,12 @@ TestImage::Frame TestImage::AddFrame() { } TestImage::Frame TestImage::AddPreview(size_t xsize, size_t ysize) { - extras::PackedFrame frame(xsize, ysize, format_); + JXL_ASSIGN_OR_DIE(extras::PackedFrame frame, + extras::PackedFrame::Create(xsize, ysize, format_)); for (size_t i = 0; i < ppf_.extra_channels_info.size(); ++i) { JxlPixelFormat ec_format = {1, format_.data_type, format_.endianness, 0}; - extras::PackedImage image(xsize, ysize, ec_format); + JXL_ASSIGN_OR_DIE(extras::PackedImage image, + extras::PackedImage::Create(xsize, ysize, ec_format)); frame.extra_channels.emplace_back(std::move(image)); } ppf_.preview_frame = make_unique<extras::PackedFrame>(std::move(frame)); |