From 92879383fbb9fc8129962c98f0447dbf0e732170 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 18 May 2021 14:41:21 +0200 Subject: [PATCH] Mandelbrot: Export images in a fixed resolution This makes the exported image independent from the current window size and just always exports it at 1920x1080. --- Userland/Demos/Mandelbrot/Mandelbrot.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 8ad6e88181..d481e827f2 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -221,7 +221,9 @@ void Mandelbrot::resize_event(GUI::ResizeEvent& event) void Mandelbrot::export_image(String const& export_path) { + m_set.resize(Gfx::IntSize { 1920, 1080 }); auto png = Gfx::PNGWriter::encode(m_set.bitmap()); + m_set.resize(size()); auto file = fopen(export_path.characters(), "wb"); if (!file) { GUI::MessageBox::show(window(), String::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot", GUI::MessageBox::Type::Error);