[Scummvm-cvs-logs] SF.net SVN: scummvm:[52321] scummvm/trunk/backends/platform/gp2xwiz

djwillis at users.sourceforge.net djwillis at users.sourceforge.net
Tue Aug 24 11:29:31 CEST 2010


Revision: 52321
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52321&view=rev
Author:   djwillis
Date:     2010-08-24 09:29:30 +0000 (Tue, 24 Aug 2010)

Log Message:
-----------
GP2XWIZ: Graphics code cleanup and start to add support for the GP2X Caanoo device.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
    scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-main.cpp

Modified: scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp	2010-08-24 09:11:53 UTC (rev 52320)
+++ scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-graphics.cpp	2010-08-24 09:29:30 UTC (rev 52321)
@@ -35,11 +35,9 @@
 
 static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
 	{"1x", "Fullscreen", GFX_NORMAL},
-//	{"\xBDx", "Downscale", GFX_HALF},
 	{0, 0, 0}
 };
 
-
 const OSystem::GraphicsMode *OSystem_GP2XWIZ::getSupportedGraphicsModes() const {
 	return s_supportedGraphicsModes;
 }
@@ -111,7 +109,6 @@
 	blitCursor();
 }
 
-
 void OSystem_GP2XWIZ::initSize(uint w, uint h) {
 	assert(_transactionMode == kTransactionActive);
 
@@ -131,13 +128,30 @@
 }
 
 bool OSystem_GP2XWIZ::loadGFXMode() {
-	_videoMode.overlayWidth = 320;
-	_videoMode.overlayHeight = 240;
-	_videoMode.fullscreen = true;
-
-	if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
+	if (_videoMode.screenWidth > 320 || _videoMode.screenHeight > 240) {
 		_videoMode.aspectRatioCorrection = false;
+		setGraphicsMode(GFX_HALF);
+		printf("GFX_HALF\n");
+	} else {
+		setGraphicsMode(GFX_NORMAL);
+		printf("GFX_NORMAL\n");
+	}
 
+	if ((_videoMode.mode == GFX_HALF) && !_overlayVisible) {
+		_videoMode.overlayWidth = _videoMode.screenWidth / 2;
+		_videoMode.overlayHeight = _videoMode.screenHeight / 2;
+		_videoMode.fullscreen = true;
+	} else {
+
+		_videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+		_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
+
+		if (_videoMode.aspectRatioCorrection)
+			_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
+
+		_videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor;
+		_videoMode.hardwareHeight = effectiveScreenHeight();
+	}
 	return OSystem_SDL::loadGFXMode();
 }
 
@@ -149,6 +163,7 @@
 
 	SDL_Rect dst;
 	int scale;
+	int width, height;
 	int hotX, hotY;
 
 	if (_videoMode.mode == GFX_HALF && !_overlayVisible){
@@ -161,12 +176,16 @@
 
 	if (!_overlayVisible) {
 		scale = _videoMode.scaleFactor;
+		width = _videoMode.screenWidth;
+		height = _videoMode.screenHeight;
 		dst.w = _mouseCurState.vW;
 		dst.h = _mouseCurState.vH;
 		hotX = _mouseCurState.vHotX;
 		hotY = _mouseCurState.vHotY;
 	} else {
 		scale = 1;
+		width = _videoMode.overlayWidth;
+		height = _videoMode.overlayHeight;
 		dst.w = _mouseCurState.rW;
 		dst.h = _mouseCurState.rH;
 		hotX = _mouseCurState.rHotX;
@@ -231,7 +250,7 @@
 	ScalerProc *scalerProc;
 	int scale1;
 
-#if defined (DEBUG) && ! defined(_WIN32_WCE) // definitions not available for non-DEBUG here. (needed this to compile in SYMBIAN32 & linux?)
+#if defined (DEBUG)
 	assert(_hwscreen != NULL);
 	assert(_hwscreen->map->sw_data != NULL);
 #endif
@@ -295,7 +314,6 @@
 		width = _videoMode.overlayWidth;
 		height = _videoMode.overlayHeight;
 		scalerProc = Normal1x;
-
 		scale1 = 1;
 	}
 
@@ -358,7 +376,7 @@
 
 				assert(scalerProc != NULL);
 
-				if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){
+				if ((_videoMode.mode == GFX_HALF) && (scalerProc == DownscaleAllByHalf)) {
 					if (dst_x%2==1){
 						dst_x--;
 						dst_w++;
@@ -371,9 +389,13 @@
 					src_y = dst_y;
 					dst_x = dst_x / 2;
 					dst_y = dst_y / 2;
+
+					scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,
+						   (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
+				} else {
+					scalerProc((byte *)srcSurf->pixels + (r->x * 2 + 2) + (r->y + 1) * srcPitch, srcPitch,
+					           (byte *)_hwscreen->pixels + r->x * 2 + dst_y * dstPitch, dstPitch, r->w, dst_h);
 				}
-				scalerProc((byte *)srcSurf->pixels + (src_x * 2 + 2) + (src_y + 1) * srcPitch, srcPitch,
-						   (byte *)_hwscreen->pixels + dst_x * 2 + dst_y * dstPitch, dstPitch, dst_w, dst_h);
 			}
 
 			if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf){

Modified: scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-main.cpp
===================================================================
--- scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-main.cpp	2010-08-24 09:11:53 UTC (rev 52320)
+++ scummvm/trunk/backends/platform/gp2xwiz/gp2xwiz-main.cpp	2010-08-24 09:29:30 UTC (rev 52321)
@@ -54,23 +54,26 @@
 #include <time.h>	// for getTimeAndDate()
 
 /* Dump console info to files. */
-// #define DUMP_STDOUT
+#define DUMP_STDOUT
 
-int main(int argc, char *argv[]) {
+// Don't use the GP2XWiz main on the Caanoo
+#ifndef CAANOO
+	int main(int argc, char *argv[]) {
 
-	g_system = new OSystem_GP2XWIZ();
-	assert(g_system);
+		g_system = new OSystem_GP2XWIZ();
+		assert(g_system);
 
-#ifdef DYNAMIC_MODULES
-	PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
-#endif
+	#ifdef DYNAMIC_MODULES
+		PluginManager::instance().addPluginProvider(new POSIXPluginProvider());
+	#endif
 
-	// Invoke the actual ScummVM main entry point:
-	int res = scummvm_main(argc, argv);
-	g_system->quit();
+		// Invoke the actual ScummVM main entry point:
+		int res = scummvm_main(argc, argv);
+		g_system->quit();
 
-	return res;
-}
+		return res;
+	}
+#endif /* CAANOO */
 
 void OSystem_GP2XWIZ::initBackend() {
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list