[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.10,1.11 sdl-common.h,1.5,1.6 sdl.cpp,1.9,1.10 sdl_gl.cpp,1.6,1.7

Max Horn fingolfin at users.sourceforge.net
Mon Oct 14 04:03:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory usw-pr-cvs1:/tmp/cvs-serv25335

Modified Files:
	sdl-common.cpp sdl-common.h sdl.cpp sdl_gl.cpp 
Log Message:
renamed get_320x200_image() to get_screen_image(); cleanup

Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- sdl-common.cpp	8 Oct 2002 07:36:25 -0000	1.10
+++ sdl-common.cpp	14 Oct 2002 11:02:26 -0000	1.11
@@ -48,8 +48,10 @@
 
 	SDL_ShowCursor(SDL_DISABLE);
 
+#ifndef MACOSX		// Don't set icon on OS X, as we use a nicer external icon there
 	// Setup the icon
 	syst->setup_icon();
+#endif
 
 #ifndef MACOSX		// Work around a bug in OS X
 	// Clean up on exit
@@ -634,7 +636,7 @@
 
 
 /* retrieve the 320x200 bitmap currently being displayed */
-void OSystem_SDL_Common::get_320x200_image(byte *buf) {
+void OSystem_SDL_Common::get_screen_image(byte *buf) {
 	/* make sure the mouse is gone */
 	undraw_mouse();
 	

Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sdl-common.h	28 Sep 2002 16:19:27 -0000	1.5
+++ sdl-common.h	14 Oct 2002 11:02:27 -0000	1.6
@@ -187,7 +187,7 @@
 	virtual void unload_gfx_mode() = 0;
 	virtual void hotswap_gfx_mode() = 0;
 
-	void get_320x200_image(byte *buf);	
+	void get_screen_image(byte *buf);	
 
 	void setup_icon();
 	void kbd_mouse();

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sdl.cpp	29 Sep 2002 18:19:57 -0000	1.9
+++ sdl.cpp	14 Oct 2002 11:02:27 -0000	1.10
@@ -27,7 +27,7 @@
 
 class OSystem_SDL_Normal : public OSystem_SDL_Common {
 public:
-	OSystem_SDL_Normal() : sdl_tmpscreen(0), sdl_hwscreen(0) {}
+	OSystem_SDL_Normal() : sdl_tmpscreen(0), sdl_hwscreen(0), _overlay_visible(false) {}
 
 	// Set colors of the palette
 	void set_palette(const byte *colors, uint start, uint num);
@@ -198,11 +198,8 @@
 
 void OSystem_SDL_Normal::load_gfx_mode() {
 	_forceFull = true;
-	_scaleFactor = 1;
-	_mode_flags = 0;
-	_overlay_visible = false;
+	_mode_flags = DF_WANT_RECT_OPTIM | DF_UPDATE_EXPAND_1_PIXEL;
 
-	_scaler_proc = NULL;
 	sdl_tmpscreen = NULL;
 	TMP_SCREEN_WIDTH = (_screenWidth + 3);
 	
@@ -243,26 +240,41 @@
 		_scaleFactor = 1;
 		_scaler_proc = Normal1x;
 		break;
+	default:
+		error("unknown gfx mode");
+		_scaleFactor = 1;
+		_scaler_proc = NULL;
 	}
 
+	//
+	// Create the surface that contains the 8 bit game data
+	//
 	_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, _screenWidth, _screenHeight, 8, 0, 0, 0, 0);
 	if (_screen == NULL)
-		error("_screen failed failed");
+		error("_screen failed");
 
-	uint16 *tmp_screen = (uint16*)calloc(TMP_SCREEN_WIDTH*(_screenHeight+3),sizeof(uint16));
-	_mode_flags = DF_WANT_RECT_OPTIM | DF_UPDATE_EXPAND_1_PIXEL;
 
+	//
+	// Create the surface that contains the scaled graphics in 16 bit mode
+	//
 	sdl_hwscreen = SDL_SetVideoMode(_screenWidth * _scaleFactor, _screenHeight * _scaleFactor, 16, 
 		_full_screen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
 	);
 	if (sdl_hwscreen == NULL)
 		error("sdl_hwscreen failed");
 	
-	/* Need some extra bytes around when using 2XSAI */
-	if (sdl_hwscreen->format->Rmask == 0x7C00)	// HACK HACK HACK
+	//
+	// Create the surface used for the graphics in 16 bit before scaling, and also the overlay
+	//
+
+	// Distinguish 555 and 565 mode
+	if (sdl_hwscreen->format->Rmask == 0x7C00)
 		Init_2xSaI(555);
 	else
 		Init_2xSaI(565);
+	
+	// Need some extra bytes around when using 2xSaI
+	uint16 *tmp_screen = (uint16*)calloc(TMP_SCREEN_WIDTH*(_screenHeight+3),sizeof(uint16));
 	sdl_tmpscreen = SDL_CreateRGBSurfaceFrom(tmp_screen,
 						TMP_SCREEN_WIDTH, _screenHeight + 3, 16, TMP_SCREEN_WIDTH*2,
 						sdl_hwscreen->format->Rmask,
@@ -402,40 +414,42 @@
 }
 
 void OSystem_SDL_Normal::hotswap_gfx_mode() {
-	/* hmm, need to allocate a 320x200 bitmap
-	 * which will contain the "backup" of the screen during the change.
-	 * then draw that to the new screen right after it's setup.
+	/* We allocate a screen sized bitmap which contains a "backup"
+	 * of the screen data during the change. Then we draw that to
+	 * the new screen right after it's setup.
 	 */
 	
 	byte *bak_mem = (byte*)malloc(_screenWidth*_screenHeight);
 
-	get_320x200_image(bak_mem);
+	get_screen_image(bak_mem);
 
 	unload_gfx_mode();
 	load_gfx_mode();
 
-	_forceFull = true;
-
 	// reset palette
 	SDL_SetColors(_screen, _currentPalette, 0, 256);
 
 	// blit image
-	OSystem_SDL_Normal::copy_rect(bak_mem, _screenWidth, 0, 0, _screenWidth, _screenHeight);
+	copy_rect(bak_mem, _screenWidth, 0, 0, _screenWidth, _screenHeight);
 	free(bak_mem);
 
-	OSystem_SDL_Normal::update_screen();
+	update_screen();
 }
 
 uint32 OSystem_SDL_Normal::property(int param, Property *value) {
 
 	if (param == PROP_TOGGLE_FULLSCREEN) {
+		assert(sdl_hwscreen != 0);
 		_full_screen ^= true;
 
 		if (!SDL_WM_ToggleFullScreen(sdl_hwscreen)) {
-			/* if ToggleFullScreen fails, achieve the same effect with hotswap gfx mode */
+			// if ToggleFullScreen fails, achieve the same effect with hotswap gfx mode
 			hotswap_gfx_mode();
 		}
 		return 1;
+	} else if (param == PROP_OVERLAY_IS_565) {
+		assert(sdl_tmpscreen != 0);
+		return (sdl_tmpscreen->format->Rmask != 0x7C00);
 	}
 	
 	return OSystem_SDL_Common::property(param, value);

Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl_gl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sdl_gl.cpp	28 Sep 2002 16:19:27 -0000	1.6
+++ sdl_gl.cpp	14 Oct 2002 11:02:27 -0000	1.7
@@ -154,12 +154,13 @@
 	
 	byte *bak_mem = (byte*)malloc(_screenWidth*_screenHeight);
 
-	get_320x200_image(bak_mem);
+	get_screen_image(bak_mem);
 
 	unload_gfx_mode();
 	load_gfx_mode();
 
 	fb2gl.setPalette(0,256);
+	// FIXME - this seems to be tied to 320x200 - what about Zak256 which needs 320x240 ?
 	fb2gl.update(_screen->pixels,320,200,320,0,_currentShakePos);
 
 	/* blit image */





More information about the Scummvm-git-logs mailing list