aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNeeraj Kumar2010-06-03 03:55:08 +0000
committerNeeraj Kumar2010-06-03 03:55:08 +0000
commitfababbe205395b6b8c812b458df3af65e3f5e01c (patch)
tree4239006dcd55d7c0677e81c41e8d2591777615ae /engines
parent91a8d25cea4eb44e55ac5e966b21c89bd044bc49 (diff)
downloadscummvm-rg350-fababbe205395b6b8c812b458df3af65e3f5e01c.tar.gz
scummvm-rg350-fababbe205395b6b8c812b458df3af65e3f5e01c.tar.bz2
scummvm-rg350-fababbe205395b6b8c812b458df3af65e3f5e01c.zip
able to display rectangle on screen using grabPalette() and copyRectToScreen, will use it to test palettes and autocomputeDirtyRects features
svn-id: r49404
Diffstat (limited to 'engines')
-rw-r--r--engines/testbed/gfxtests.cpp67
-rw-r--r--engines/testbed/gfxtests.h13
-rw-r--r--engines/testbed/graphics.cpp39
-rw-r--r--engines/testbed/module.mk1
4 files changed, 89 insertions, 31 deletions
diff --git a/engines/testbed/gfxtests.cpp b/engines/testbed/gfxtests.cpp
new file mode 100644
index 0000000000..3beed2aa44
--- /dev/null
+++ b/engines/testbed/gfxtests.cpp
@@ -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;
+
+}
+
+}
diff --git a/engines/testbed/gfxtests.h b/engines/testbed/gfxtests.h
new file mode 100644
index 0000000000..7f5ae7d8af
--- /dev/null
+++ b/engines/testbed/gfxtests.h
@@ -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
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index a2b6a8657b..67176683ee 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -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 @@ int GFXTestSuite::execute() {
//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;
}
+
}
diff --git a/engines/testbed/module.mk b/engines/testbed/module.mk
index 368b37b677..0c19aba441 100644
--- a/engines/testbed/module.mk
+++ b/engines/testbed/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/testbed
MODULE_OBJS := \
detection.o \
graphics.o \
+ gfxtests.o \
testbed.o
MODULE_DIRS += \