[Scummvm-cvs-logs] SF.net SVN: scummvm:[49404] scummvm/branches/gsoc2010-testbed/engines/ testbed

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Thu Jun 3 05:55:08 CEST 2010


Revision: 49404
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49404&view=rev
Author:   sud03r
Date:     2010-06-03 03:55:08 +0000 (Thu, 03 Jun 2010)

Log Message:
-----------
able to display rectangle on screen using grabPalette() and copyRectToScreen, will use it to test palettes and autocomputeDirtyRects features

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk

Added Paths:
-----------
    scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h

Added: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp	2010-06-03 03:55:08 UTC (rev 49404)
@@ -0,0 +1,67 @@
+#include "testbed/gfxtests.h"
+#include "testbed/testsuite.h"
+#include "graphics/pixelformat.h"
+
+namespace Testbed {
+
+bool testFullScreenMode() {
+
+	printf("Testing fullscreen mode\n");
+	
+	bool isFeaturePresent;
+	bool isFeatureEnabled;
+
+	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode);
+	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
+
+	printf("Testing Feature Presence.. \n");
+
+	if (isFeaturePresent) {
+		//Toggle
+		printf("Supported\n");
+
+		g_system->beginGFXTransaction();
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
+		g_system->endGFXTransaction();
+
+		g_system->delayMillis(1000);
+		
+		g_system->beginGFXTransaction();
+		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
+		g_system->endGFXTransaction();
+	}
+
+	return true;
+}
+
+bool testAspectRatio() {
+	
+	int x_lim;
+	int y_lim;
+
+	x_lim = g_system->getWidth();
+	y_lim = g_system->getHeight();
+
+	Graphics::PixelFormat f = g_system->getScreenFormat();
+
+	printf("Screen is %d x %d using %d bytes per pixel\n", x_lim, y_lim, f.bytesPerPixel);
+
+	char blackbuf[16 * 20];
+	memset(blackbuf, 1, 16 * 20); // Prepare a buffer 16px wide and 240px high, to fit on a lateral strip
+
+	uint8 pal[2 * 4];
+	g_system->grabPalette(pal, 0, 2);
+	pal[4] = 255;
+	pal[5] = 255;
+	pal[6] = 0;
+
+	g_system->setPalette(pal, 0, 2);
+
+    g_system->copyRectToScreen((const byte *)blackbuf, 16, 20, 28, 16, 20); // Fix left strip
+	g_system->updateScreen();
+
+	return true;
+
+}
+
+}


Property changes on: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h	                        (rev 0)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h	2010-06-03 03:55:08 UTC (rev 49404)
@@ -0,0 +1,13 @@
+#ifndef GFXTESTS_H
+#define GFXTESTS_H
+
+namespace Testbed {
+
+// will contain function declarations for GFX tests
+bool testFullScreenMode(); 
+bool testAspectRatio();
+// add more here
+
+}
+
+#endif


Property changes on: scummvm/branches/gsoc2010-testbed/engines/testbed/gfxtests.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-03 03:22:10 UTC (rev 49403)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-06-03 03:55:08 UTC (rev 49404)
@@ -1,41 +1,17 @@
 #include "testbed/graphics.h"
+#include "testbed/gfxtests.h"
 
 namespace Testbed {
 
-bool testFullScreenMode() {
-
-	printf("Testing fullscreen mode\n");
-	bool isFeaturePresent;
-	bool isFeatureEnabled;
-
-	isFeaturePresent = g_system->hasFeature(OSystem::kFeatureFullscreenMode);
-	isFeatureEnabled = g_system->getFeatureState(OSystem::kFeatureFullscreenMode);
-
-	printf("Testing Feature Presence.. \n");
-	if (isFeaturePresent) {
-		//Toggle
-		printf("Supported\n");
-
-		g_system->beginGFXTransaction();
-		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, !isFeatureEnabled);
-		g_system->endGFXTransaction();
-
-		g_system->delayMillis(1000);
-		
-		g_system->beginGFXTransaction();
-		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, isFeatureEnabled);
-		g_system->endGFXTransaction();
-	}
-
-	return true;
-}
-
 GFXTestSuite::GFXTestSuite() {
-	addTest("FullScreenMode", &testFullScreenMode);
+	//addTest("FullScreenMode", &testFullScreenMode);
+	addTest("AspectRatio", &testAspectRatio);
 }
 
 GFXTestSuite::~GFXTestSuite() {
-	printf("Cleanup\n");
+	for (Common::Array<Test*>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
+		delete (*i);
+	}
 }
 
 const char *GFXTestSuite::getName() {
@@ -46,10 +22,11 @@
 	//TODO: Implement the method
 	for (Common::Array<Test*>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
 		printf("Executing Test:%s\n", ((*i)->featureName).c_str());
-		printf("Result:%d",(*i)->driver());
+		printf("Result:%d\n",(*i)->driver());
 	}
 
 	return 1;
 }
 
+
 }

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-06-03 03:22:10 UTC (rev 49403)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/module.mk	2010-06-03 03:55:08 UTC (rev 49404)
@@ -3,6 +3,7 @@
 MODULE_OBJS := \
 	detection.o \
 	graphics.o \
+	gfxtests.o \
 	testbed.o
  
 MODULE_DIRS += \


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