From c3f3d00f14d202ff4cc6749ea5272218b6d38c83 Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Sat, 12 Apr 2025 04:29:12 +0200 Subject: [PATCH] Crop frame view exports to current video size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The base video size of the Game Boy core is the Super Game Boy’s resolution of 256×224 pixels. Previously frames were exported at that size, leading to a 160×144 frame surrounded by uninitialized memory. This assumes that the base size is always greater or equal to the current video size. --- src/platform/qt/FrameView.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/qt/FrameView.cpp b/src/platform/qt/FrameView.cpp index 245ebf4bb..bec285f7f 100644 --- a/src/platform/qt/FrameView.cpp +++ b/src/platform/qt/FrameView.cpp @@ -594,7 +594,16 @@ void FrameView::exportFrame() { return; } CoreController::Interrupter interrupter(m_controller); - m_framebuffer.save(filename, "PNG"); + + unsigned width, height; + m_vl->currentVideoSize(m_vl, &width, &height); + + if ((int)width != m_framebuffer.width() || (int)height != m_framebuffer.height()) { + QImage crop = m_framebuffer.copy(0, 0, width, height); + crop.save(filename, "PNG"); + } else { + m_framebuffer.save(filename, "PNG"); + } } void FrameView::reset() {