1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:57:45 +00:00

LibGfx: Make QOIWriter use ErrorOr

In addition to it now handling allocation failures, the encode() API is
now consistent with PNGWriter.
This commit is contained in:
Nico Weber 2023-03-12 09:05:25 -04:00 committed by Linus Groh
parent b698d64ee9
commit 9b297c634f
6 changed files with 62 additions and 52 deletions

View file

@ -35,7 +35,7 @@ static void expect_bitmap_equals_reference(Gfx::Bitmap const& bitmap, StringView
if constexpr (SAVE_OUTPUT) {
auto target_path = LexicalPath("/home/anon").append(reference_filename);
auto qoi_buffer = Gfx::QOIWriter::encode(bitmap);
auto qoi_buffer = MUST(Gfx::QOIWriter::encode(bitmap));
auto qoi_output_stream = MUST(Core::File::open(target_path.string(), Core::File::OpenMode::Write));
MUST(qoi_output_stream->write_entire_buffer(qoi_buffer));
}