Mercurial > sdl-ios-xcode
diff src/video/bwindow/SDL_sysvideo.cc @ 756:10332c6fad2e
te: Mon, 15 Dec 2003 08:25:14 -0800 PST
From: "Andrew Bachmann"
Subject: libSDL patches for beos video
I created some patches to SDL:
1. YUV overlay support
2. maintain high refresh rate when changing resolutions to a lower resolution
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 16 Dec 2003 13:04:44 +0000 |
parents | f6ffac90895c |
children | b8d311d90021 |
line wrap: on
line diff
--- a/src/video/bwindow/SDL_sysvideo.cc Sun Dec 14 06:28:07 2003 +0000 +++ b/src/video/bwindow/SDL_sysvideo.cc Tue Dec 16 13:04:44 2003 +0000 @@ -47,6 +47,8 @@ #include "SDL_events_c.h" #include "SDL_syswm_c.h" #include "SDL_lowvideo.h" +#include "SDL_yuvfuncs.h" +#include "SDL_sysyuv.h" #define BEOS_HIDDEN_SIZE 32 /* starting hidden window size */ @@ -65,6 +67,7 @@ static void BE_FreeHWSurface(_THIS, SDL_Surface *surface); static int BE_ToggleFullScreen(_THIS, int fullscreen); +static SDL_Overlay *BE_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, SDL_Surface *display); /* OpenGL functions */ #ifdef HAVE_OPENGL @@ -136,6 +139,7 @@ device->free = BE_DeleteDevice; device->ToggleFullScreen = BE_ToggleFullScreen; + device->CreateYUVOverlay = BE_CreateYUVOverlay; /* Set the driver flags */ device->handles_any_size = 1; @@ -330,6 +334,11 @@ uint32 i, nmodes; SDL_Rect **modes; display_mode *dmodes; + display_mode current; + float current_refresh; + bscreen.GetMode(¤t); + current_refresh = (1000 * current.timing.pixel_clock) / + (current.timing.h_total * current.timing.v_total); modes = SDL_modelist[((bpp+7)/8)-1]; for ( i=0; modes[i] && (modes[i]->w > width) && @@ -351,6 +360,15 @@ } if ( i != nmodes ) { *mode = dmodes[i]; + if ((mode->virtual_width <= current.virtual_width) && + (mode->virtual_height <= current.virtual_height)) { + float new_refresh = (1000 * mode->timing.pixel_clock) / + (mode->timing.h_total * mode->timing.v_total); + if (new_refresh < current_refresh) { + mode->timing.pixel_clock = (uint32)((mode->timing.h_total * mode->timing.v_total) + * current_refresh / 1000); + } + } return true; } else { return false;