mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
headless-browser: Port screenshot output to Core::Stream
As noted in https://github.com/SerenityOS/serenity/issues/15239 `headless-browser` is currently broken, with or without these changes.
This commit is contained in:
parent
2228786329
commit
78a94cd3b7
1 changed files with 2 additions and 3 deletions
|
@ -16,7 +16,6 @@
|
|||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/IODevice.h>
|
||||
#include <LibCore/MemoryStream.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
|
@ -725,7 +724,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (Core::File::exists(output_file_path))
|
||||
[[maybe_unused]]
|
||||
auto ignored = Core::File::remove(output_file_path, Core::File::RecursionMode::Disallowed, true);
|
||||
auto output_file = MUST(Core::File::open(output_file_path, Core::OpenMode::WriteOnly));
|
||||
auto output_file = MUST(Core::Stream::File::open(output_file_path, Core::Stream::OpenMode::Write));
|
||||
|
||||
auto output_rect = page_client->screen_rect();
|
||||
auto output_bitmap = MUST(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, output_rect.size()));
|
||||
|
@ -733,7 +732,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
page_client->paint(output_rect, output_bitmap);
|
||||
|
||||
auto image_buffer = Gfx::PNGWriter::encode(output_bitmap);
|
||||
output_file->write(image_buffer.data(), image_buffer.size());
|
||||
MUST(output_file->write(image_buffer.bytes()));
|
||||
|
||||
exit(0);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue