mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 12:18:56 +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
Notes:
sideshowbarker
2024-07-17 04:16:47 +09:00
Author: https://github.com/AtkinsSJ
Commit: 78a94cd3b7
Pull-request: https://github.com/SerenityOS/serenity/pull/15244
Reviewed-by: https://github.com/davidot ✅
Reviewed-by: https://github.com/demostanis
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