Commit 576d64cb authored by Patrice Mandin's avatar Patrice Mandin

Allow creation of window bigger than visible size

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402318
parent d3b8d75c
...@@ -621,30 +621,27 @@ static void GEM_UnlockScreen(_THIS) ...@@ -621,30 +621,27 @@ static void GEM_UnlockScreen(_THIS)
SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
int width, int height, int bpp, Uint32 flags) int width, int height, int bpp, Uint32 flags)
{ {
int maxwidth, maxheight;
Uint32 modeflags, screensize; Uint32 modeflags, screensize;
SDL_bool use_shadow1, use_shadow2; SDL_bool use_shadow1, use_shadow2;
/*--- Verify if asked mode can be used ---*/
if (flags & SDL_FULLSCREEN) {
maxwidth=VDI_w;
maxheight=VDI_h;
} else {
/* Windowed mode */
maxwidth=GEM_desk_w;
maxheight=GEM_desk_h;
}
/* width must be multiple of 16, for vro_cpyfm() and c2p_convert() */ /* width must be multiple of 16, for vro_cpyfm() and c2p_convert() */
if ((width & 15) != 0) { if ((width & 15) != 0) {
width = (width | 15) +1; width = (width | 15) +1;
} }
if ((maxwidth < width) || (maxheight < height) || (VDI_bpp != bpp)) { /*--- Verify if asked mode can be used ---*/
SDL_SetError("Couldn't find requested mode in list"); if (VDI_bpp != bpp) {
SDL_SetError("%d bpp mode not supported", bpp);
return(NULL); return(NULL);
} }
if (flags & SDL_FULLSCREEN) {
if ((VDI_w < width) || (VDI_h < height)) {
SDL_SetError("%dx%d mode is too large", width, height);
return(NULL);
}
}
/*--- Allocate the new pixel format for the screen ---*/ /*--- Allocate the new pixel format for the screen ---*/
if ( ! SDL_ReallocFormat(current, VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, VDI_alphamask) ) { if ( ! SDL_ReallocFormat(current, VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, VDI_alphamask) ) {
SDL_SetError("Couldn't allocate new pixel format for requested mode"); SDL_SetError("Couldn't allocate new pixel format for requested mode");
...@@ -750,8 +747,16 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -750,8 +747,16 @@ SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
} }
/* Center window */ /* Center window */
x2 = GEM_desk_x+((GEM_desk_w-w2)>>1); x2 = (GEM_desk_w-w2)>>1;
y2 = GEM_desk_y+((GEM_desk_h-h2)>>1); y2 = (GEM_desk_h-h2)>>1;
if (x2<0) {
x2 = 0;
}
if (y2<0) {
y2 = 0;
}
x2 += GEM_desk_x;
y2 += GEM_desk_y;
/* Destroy existing window */ /* Destroy existing window */
if (GEM_handle >= 0) { if (GEM_handle >= 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment