changeset 84:802fbd1760ae

aspect ratio patch by Felix B¸«änemann
author arpi_esp
date Sun, 11 Mar 2001 17:17:03 +0000
parents a765e3ddeb39
children eef63c5da277
files libvo/vo_sdl.c
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_sdl.c	Sun Mar 11 17:03:28 2001 +0000
+++ b/libvo/vo_sdl.c	Sun Mar 11 17:17:03 2001 +0000
@@ -27,7 +27,7 @@
  *
  *  Changes:
  *    Dominik Schnitzer <dominik@schnitzer.at> - November 08, 2000.
- *    - Added resizing support, fullscreen: chnaged the sdlmodes selection
+ *    - Added resizing support, fullscreen: changed the sdlmodes selection
  *       routine.
  *    - SDL bugfixes: removed the atexit(SLD_Quit), SDL_Quit now resides in
  *       the plugin_exit routine.
@@ -40,6 +40,8 @@
  *    - Better error handling
  *    Bruno Barreyra <barreyra@ufl.edu> - December 10, 2000.
  *    - Eliminated memcpy's for entire frames
+ *    Felix Buenemann <Felix.Buenemann@ePost.de> - March 11, 2001
+ *    - Added aspect-ratio awareness for fullscreen
  */
 
 #include <stdio.h>
@@ -58,7 +60,7 @@
 
 static vo_info_t vo_info = 
 {
-	"SDL YUV overlay (SDL v1.1.7 only!)",
+	"SDL YUV overlay (SDL v1.1.7+ only!)",
 	"sdl",
 	"Ryan C. Gordon <icculus@lokigames.com>",
 	""
@@ -138,7 +140,7 @@
 
 //	LOG (LOG_DEBUG, "SDL video out: Opened Plugin");
 	
-	/* default to no fullscreen mode, we'll set this as soon we have the avail. mdoes */
+	/* default to no fullscreen mode, we'll set this as soon we have the avail. modes */
 	priv->fullmode = -2;
 	/* other default values */
 	priv->sdlflags = SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT;
@@ -254,14 +256,19 @@
 {
 	struct sdl_priv_s *priv = &sdl_priv;
 	SDL_Surface *newsurface = NULL;
-	
+	unsigned int aspect;
 	
 	/* if we haven't set a fullmode yet, default to the lowest res fullmode first */
 	if (mode < 0) 
 		mode = priv->fullmode = findArrayEnd(priv->fullmodes) - 1;
 
-	/* change to given fullscreen mode and hide the mouse cursor*/
-	newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w, priv->fullmodes[mode]->h, priv->bpp, priv->sdlfullflags);
+	/* Calculate proper aspect ratio for fullscreen */
+	aspect = (priv->width * 0.75 - priv->height) * (float) ((float) priv->fullmodes[mode]->w / (float) priv->width);
+//	printf ("Aspect: %i\n", aspect);
+	
+	/* change to given fullscreen mode and hide the mouse cursor
+	   Felix Buenemann: added - aspect to use proper aspect ratio in fullscreen */
+	newsurface = SDL_SetVideoMode(priv->fullmodes[mode]->w, priv->fullmodes[mode]->h - aspect, priv->bpp, priv->sdlfullflags);
 	
 	/* if we were successfull hide the mouse cursor and save the mode */
 	if (newsurface) {
@@ -286,7 +293,7 @@
 //static int sdl_setup (int width, int height)
 {
 	struct sdl_priv_s *priv = &sdl_priv;
-        unsigned int sdl_format;
+        unsigned int sdl_format, aspectheight;
 
         switch(format){
           case IMGFMT_YV12: sdl_format=SDL_YV12_OVERLAY;break;
@@ -299,7 +306,7 @@
 	sdl_open (NULL, NULL);
 
 	/* Save the original Image size */
-
+	
 	priv->width  = width;
 	priv->height = height;
         priv->format = format;
@@ -491,7 +498,6 @@
 				 	if (priv->surface->flags & SDL_FULLSCREEN) {
 						priv->surface = SDL_SetVideoMode(priv->windowsize.w, priv->windowsize.h, priv->bpp, priv->sdlflags);
 						SDL_ShowCursor(1);
-						
 //						LOG (LOG_DEBUG, "SDL video out: Windowed mode");
 					} 
 					else if (priv->fullmodes){