diff options
| author | Eero Tamminen <oak@helsinkinet.fi> | 2021-04-05 17:38:38 (GMT) |
|---|---|---|
| committer | Eero Tamminen <oak@helsinkinet.fi> | 2021-04-06 21:12:24 (GMT) |
| commit | 0f644d708897dd1aa72fe4512010c79f1ebcd969 (patch) | |
| tree | 985ba33c06ab82736f3cf95cf9ce3987f798c545 | |
| parent | 2c98b7a2967b312ea4f291b0cf62a4fdaad8740d (diff) | |
| download | hatari-0f644d708897dd1aa72fe4512010c79f1ebcd969.zip hatari-0f644d708897dd1aa72fe4512010c79f1ebcd969.tar.gz | |
Fullscreen and windowed mode SDL2 filtering need separate rules
Because SDL2 letterboxes fullscreen, it should be enough to check
that just closer dimension is evenly divisable before allowing
nearest neighbor scaling.
| -rw-r--r-- | src/screen.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/screen.c b/src/screen.c index 87f29bb..bdc6941 100644 --- a/src/screen.c +++ b/src/screen.c @@ -334,7 +334,18 @@ void Screen_SetTextureScale(int width, int height, int win_width, int win_height scale_w = (float)win_width / width; scale_h = (float)win_height / height; - scale = (scale_w + scale_h) / 2.0; + if (bInFullScreen) + /* SDL letterboxes fullscreen so it's enough for + * closest dimension to window size being evenly + * divisable. + */ + scale = fminf(scale_w, scale_h); + else + /* For windowed mode (= no letterboxing), both + * dimensions (here, their avg) need to be evenly + * divisable for nearest neighbor scaling to look good. + */ + scale = (scale_w + scale_h) / 2.0; if (scale == floorf(scale)) quality = '0'; // nearest pixel |
