stardot / b-em

An opensource BBC Micro emulator for Win32 and Linux
http://stardot.org.uk/forums/viewtopic.php?f=4&t=10823
GNU General Public License v2.0
112 stars 57 forks source link

Save Screenshot misses out bottom line of display? #148

Closed nergix closed 3 years ago

nergix commented 3 years ago

With a self-build from master on Linux:

try

MODE 2 MOVE 0,0 DRAW 1280,0

which will draw a horizontal line along the bottom of the screen. Then choose File->Save Screenshot from the menu. At least for me, the resulting PNG file is missing the line that was just drawn.

A naive fix is

--- vidalleg.c.orig     2021-04-01 16:44:37.161101175 +0100
+++ vidalleg.c  2021-04-01 17:16:04.309068779 +0100
@@ -215,7 +215,7 @@
     vid_savescrshot--;
     if (!vid_savescrshot) {
         int xsize = lastx - firstx;
-        int ysize = lasty - firsty;
+        int ysize = 1 + lasty - firsty;
         ALLEGRO_BITMAP *scrshotb  = al_create_bitmap(xsize, ysize << 1);
         int c;

but perhaps something more sophisticated than this is required?

SteveFosdick commented 3 years ago

I have fixed this, though somewhere slightly different. In video.c there were the lines:

if (scry + 1 > lasty)
    lasty = scry;

which was obviously inconsistent. That resulted in the range firstx to lastx being inclusive of the start and exclusive or the end (as is common in programming) while the Y direction was inclusive of both start and end. I have changed video.c so the Y direction is like the X and now the missing line is included. This change is now merged to master.