Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions gen_img.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ long x1,x2,x3,x4,y1,y2,y3,y4;
double color;
double xcenter, ycenter, width, height;

// Original DOS version targeted 8:5 display (320x200) but also supported 4:3 displays.
// Apply the necessary correction here:
const double aspect_correction = (8.0 / 5.0) / ((double)_width / (double)_height);

if (normalize) {
xcenter = (double)(_xcenter * 320) / _width;
ycenter = (double)(_ycenter * 200) / _height;
ycenter = (double)(_ycenter * 200 * aspect_correction) / _height;
width = (double)320;
height = (double)200;
} else {
Expand Down Expand Up @@ -73,7 +77,7 @@ long x1,x2,x3,x4,y1,y2,y3,y4;
{
#ifdef ENABLE_FLOAT
if (normalize) {
y = (double)(_y * 200) / _height;
y = (double)(_y * 200 * aspect_correction) / _height;
} else {
y = _y;
}
Expand Down