Crop frame view exports to current video size

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.
This commit is contained in:
Maximilian Mader 2025-04-12 04:29:12 +02:00 committed by Vicki Pfau
parent 35b6003a7d
commit c3f3d00f14
1 changed files with 10 additions and 1 deletions

View File

@ -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() {