changeset 941:81ff7111fedf

Adjust aspect ration stuff in view64.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Feb 2015 22:11:16 +0200
parents ff18d2511843
children 38cad00b41dd
files tools/view64.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tools/view64.c	Wed Feb 25 22:01:23 2015 +0200
+++ b/tools/view64.c	Wed Feb 25 22:11:16 2015 +0200
@@ -280,9 +280,8 @@
                 break;
             
             case SDL_VIDEORESIZE:
-                optScrWidth = event.resize.w;
+                optScrWidth  = event.resize.w;
                 optScrHeight = event.resize.h;
-
                 if (!dmInitializeVideo(&screen))
                     goto error;
 
@@ -299,13 +298,17 @@
         
         if (needRedraw)
         {
+            float aspect = (float) bmap.height / (float) bmap.width;
+            int sheight = optScrWidth * aspect * C64_SCR_PAR_XY;
+            int ypos = (optScrHeight - sheight) / 2;
+
             if (SDL_MUSTLOCK(screen) != 0 && SDL_LockSurface(screen) != 0)
             {
                 dmError("Can't lock surface.\n");
                 goto error;
             }
             
-            dmScaledBlitSurface8to8(surf, 0, 0, screen->w, screen->h, screen);
+            dmScaledBlitSurface8to8(surf, 0, ypos, optScrWidth, sheight, screen);
             SDL_SetColors(screen, (SDL_Color *)dmC64Palette, 0, C64_NCOLORS);
 
             if (SDL_MUSTLOCK(screen) != 0)