Re: [hatari-devel] Hatari screen options (was: Hatari manual.html)
• To: hatari-devel@xxxxxxxxxxxxxxxxxxx
• Subject: Re: [hatari-devel] Hatari screen options (was: Hatari manual.html)
• From: David Savinkoff <dsavnkff@xxxxxxxxx>
• Date: Tue, 4 Mar 2014 20:06:06 -0700 (MST)
• Thread-index: 5KJ2HZpjNEPhvJozWr1JeD/s0+zG2Q==
• Thread-topic: Hatari screen options (was: Hatari manual.html)

```Hi Eero,

Here is a patch that automatically makes the right border wider than
the left border, depending on MaxWidth, to better utilize the available
screen space. This patch adds functionality without loss of previous
functionality.

Hatari previously would use borders as:

nBorderPixelsLeft = 0 or 16 or 32 or 48
nBorderPixelsRight = nBorderPixelsLeft
(four possibilities)

now:

nBorderPixelsLeft = 0 or 16 or 32 or 48
nBorderPixelsRight = nBorderPixelsLeft + 0 or 16
(more useful possibilities)

The algorithm for determining nBorderPixelsRight is:

nBorderPixelsRight = nBorderPixelsLeft + ( (leftX % 32 < 8) ? 0 : 16);

leftX is used because it is available and has enough information
to make a determination of what to do ( leftX = (MaxW - Width)/zoom,
where Width/zoom is dividable by 32, thus,
leftX modulus 32 equals MaxW modulus 32). Note that zoom is 1 or 2.

Examining:
( (leftX % 32 < 8) ? 0 : 16)

Any (screen Width)/zoom that are evenly dividable by 32 may be
centered and have equal borders:
nBorderPixelsRight = nBorderPixelsLeft
(same as before patch)

(screen Width)/zoom that have a remainder of 1 through 7 have
equal borders, and may be offset from center
(same as before patch)

(screen Width)/zoom that have a remainder of 8 through 31 have
a wider right border, and are slightly offset from center
(new)

The remainder 8 is to accommodate 360x200 with a wider right border.
Other modes with a wider right border have a remainder of 16.

Sincerely,
David Savinkoff
```
```--- hatari/src/screen.c	2014-02-24 13:44:42.000000000 -0800
+++ hatari/src/screen.c	2014-03-04 14:32:52.000000000 -0800
@@ -296,7 +296,7 @@
* the limits when config values are set or changed
*/
nBorderPixelsLeft = VDI_Limit(leftX/2, 16, 0, 48);
-	nBorderPixelsRight = nBorderPixelsLeft;
+	nBorderPixelsRight = nBorderPixelsLeft + ( (leftX % 32 < 8) ? 0 : 16);

/* assertain assumption of code below */
assert(OVERSCAN_TOP < MAX_OVERSCAN_BOTTOM);
```

 Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/