Hans de Goede
Sat, 02 Sep 2006 08:16:05 -0700
And the promised, muck only with Linux stuff and don't try to fix stuff I don't have knowledge of / experience with patch. I think this is the one to apply. p.s. I would love to also write a few cleanup patches, for example all that minimize / maximize stuff in windows.c seems to essential boil down to nothing, because it only changes the window rect and then this rect gets reinitialised with the proper values. Let me know if you're interested in some cruft removal patches for this.
diff -ur sdlmame0108u1.orig/src/sdl/drawsdl.c sdlmame0108u1/src/sdl/drawsdl.c
--- sdlmame0108u1.orig/src/sdl/drawsdl.c 2006-08-18 04:42:02.000000000 +0200
+++ sdlmame0108u1/src/sdl/drawsdl.c 2006-09-02 17:15:42.000000000 +0200
@@ -380,7 +380,8 @@
hofs = (window->wind_rect.right - sdl->blitwidth) / 2;
}
- surfptr += ((vofs * window->sdlsurf->pitch) + hofs*4);
+ surfptr += vofs * window->sdlsurf->pitch +
+ hofs * window->sdlsurf->format->BytesPerPixel;
// render to it
osd_lock_acquire(window->primlist->lock);
@@ -723,6 +724,11 @@
update_outer_rects(sdl);
// printf("SDL: New blit size = %dx%d (was %dx%d)\n", newwidth, newheight, window->wind_rect.right, window->wind_rect.bottom);
+ /* Do not do this under Linux/X11, it isn't nescesarry and
+ resizing while being resized cause our idea of the window
+ size and the real window size to differ, causing the image
+ to be off center or even missing parts */
+ #ifndef SDLMAME_LINUX
// fit window to best size (make this an option?)
if ((!window->fullscreen) && ((newwidth != window->wind_rect.right) || (newheight != window->wind_rect.bottom)))
{
@@ -737,9 +743,10 @@
complete_create(window);
}
+ #endif
}
- if (((sdl->blitwidth != newwidth) || (sdl->blitheight != newheight)) && !(window->opengl))
+ if (((sdl->blitwidth != newwidth) || (sdl->blitheight != newheight)) && !(window->opengl) && window->sdlsurf)
{
clear_surface(window);
clear_surface(window);
diff -ur sdlmame0108u1.orig/src/sdl/window.c sdlmame0108u1/src/sdl/window.c
--- sdlmame0108u1.orig/src/sdl/window.c 2006-08-18 04:42:02.000000000 +0200
+++ sdlmame0108u1/src/sdl/window.c 2006-09-02 17:11:56.000000000 +0200
@@ -165,6 +166,10 @@
{
sdl_window_info *window = sdl_window_list;
+ #ifdef SDLMAME_LINUX
+ SDL_SetVideoMode(width, height, 0, SDL_SWSURFACE | SDL_DOUBLEBUF |
+ SDL_ANYFORMAT | window->extra_flags);
+ #endif
window->wind_rect.right = width;
window->wind_rect.bottom = height;
@@ -574,6 +579,19 @@
else
{
window->extra_flags = SDL_RESIZABLE;
+ /* Create the window directly with the correct aspect
+ instead of letting compute_blit_surface_size() resize it
+ this stops the window from "flashing" from the wrong aspect
+ size to the right one at startup. We can only do this
+ on Linux as on other platforms compute_blit_surface_size()
+ will call us and we it again, etc. */
+ #ifdef SDLMAME_LINUX
+ window->wind_rect.right = tempwidth;
+ window->wind_rect.bottom = tempheight;
+ compute_blit_surface_size(window);
+ tempwidth = sdl->blitwidth;
+ tempheight = sdl->blitheight;
+ #endif
}
if (window->opengl)