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

sud03r at users.sourceforge.net sud03r at users.sourceforge.net
Sun Jul 25 22:50:59 CEST 2010


Revision: 51284
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51284&view=rev
Author:   sud03r
Date:     2010-07-25 20:50:59 +0000 (Sun, 25 Jul 2010)

Log Message:
-----------
TETBED: fixed the boundary error in palette rotation, added colored progress bar now

Modified Paths:
--------------
    scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
    scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-07-25 20:41:23 UTC (rev 51283)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp	2010-07-25 20:50:59 UTC (rev 51284)
@@ -82,6 +82,12 @@
 	_palette[8] = r;
 	_palette[9] = g;
 	_palette[10] = b;
+	
+	// Set colorNum kColorSpecial with a special color.
+	int absIndx = kColorSpecial * 4;
+	_palette[absIndx + 1] = 173;
+	_palette[absIndx + 2] = 255;
+	_palette[absIndx + 3] = 47;
 	g_system->setPalette(_palette, 0, 256);
 }
 
@@ -125,7 +131,7 @@
 	float g = gComp;
 	float b = bComp;
 
-	float h = hue * (360 / 254.0); // two colors are left for bg and fg
+	float h = hue * (360 / 256.0); // All colors are tried
 	float s = sat;
 	float v = val;
 
@@ -901,26 +907,25 @@
 
 bool GFXtests::paletteRotation() {
 	
-	Testsuite::clearScreen();
 	Common::String info = "Palette rotation. Here we draw a full 256 colored rainbow and then rotate it.\n"
-						"Note that the screen graphics change without having to draw anything.";
+						"Note that the screen graphics change without having to draw anything.\n"
+						"The palette should appear to rotate, Click the mouse button to exit.";
 
 	if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
 		Testsuite::logPrintf("Info! Skipping test : palette Rotation\n");
 		return true;
 	}
 	Common::Point pt(0, 10);
-	Testsuite::writeOnScreen("Rotating palettes, palettes rotate towards left, click to stop!", pt);
+	Testsuite::clearEntireScreen();
 
 	// Use 256 colors
-	byte palette[256 * 4] = {0, 0, 0, 0,
-							 255, 255, 255, 0};
+	byte palette[256 * 4] = {0};
 
 	int r, g, b;
 	int colIndx;
 
-	for (int i = 2; i < 256; i++) {
-		HSVtoRGB(r, g, b, i - 2, 1, 1);
+	for (int i = 0; i < 256; i++) {
+		HSVtoRGB(r, g, b, i, 1, 1);
 		colIndx = i * 4;
 		palette[colIndx] = r;
 		palette[colIndx + 1] = g;
@@ -930,29 +935,28 @@
 	// Initialize this palette.
 	g_system->setPalette(palette, 0, 256);
 
-	// Draw 254 Rectangles, each 1 pixel wide and 10 pixels long
+	// Draw 256 Rectangles, each 1 pixel wide and 10 pixels long
 	// one for 0-255 color range other for 0-127-255 range
-	byte buffer[254 * 30] = {0};
+	byte buffer[256 * 30] = {0};
 
 	for (int i = 0; i < 30; i++) {
-		for (int j = 0; j < 254; j++) {
+		for (int j = 0; j < 256; j++) {
 			if (i < 10) {
-				buffer[i * 254 + j] = j + 2;
+				buffer[i * 256 + j] = j + 2;
 			} else if (i < 20) {
-				buffer[i * 254 + j] = 0;
+				buffer[i * 256 + j] = 0;
 			} else {
-				buffer[i * 254 + j] = ((j + 127) % 254) + 2;
+				buffer[i * 256 + j] = ((j + 127) % 256) + 2;
 			}
 		}
 	}
 
-	g_system->copyRectToScreen(buffer, 254, 22, 50, 254, 30);
+	g_system->copyRectToScreen(buffer, 256, 22, 50, 256, 30);
 	
 	// Show mouse
 	CursorMan.showMouse(true);
 	g_system->updateScreen();
 
-	g_system->delayMillis(1000);
 
 	bool toRotate = true;
 	Common::Event event;
@@ -964,7 +968,7 @@
 			}
 		}
 
-		rotatePalette(&palette[8], 254);
+		rotatePalette(palette, 256);
 
 		g_system->delayMillis(10);
 		g_system->setPalette(palette, 0, 256);

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp	2010-07-25 20:41:23 UTC (rev 51283)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.cpp	2010-07-25 20:50:59 UTC (rev 51284)
@@ -121,6 +121,8 @@
 	_numTestsExecuted = 0;
 	// Initially all testsuites are enabled, disable them by calling enableTestSuite(name, false)
 	_isTsEnabled = true;
+	// Set custom color for progress bar
+	GFXTestSuite::setCustomColor(0, 0, 0);
 }
 
 Testsuite::~Testsuite() {
@@ -247,6 +249,7 @@
 void Testsuite::updateStats(const char *prefix, const char *info, uint testNum, uint numTests, Common::Point pt) {
 	Common::String text = Common::String::printf(" Running %s: %s (%d of %d) ", prefix, info, testNum, numTests);
 	writeOnScreen(text, pt);
+	uint barColor = kColorSpecial; 
 	// below the text a rectangle denoting the progress in the testsuite can be drawn.
 	int separation = getLineSeparation();
 	pt.y += separation;
@@ -259,17 +262,17 @@
 	int wShaded = (int) (wRect * (((float)testNum) / numTests));
 
 	// draw the boundary
-	memset(buffer, 1, sizeof(byte) * wRect);
-	memset(buffer + (wRect * (lRect - 1)) , 1, sizeof(byte) * wRect);
+	memset(buffer, barColor, sizeof(byte) * wRect);
+	memset(buffer + (wRect * (lRect - 1)) , barColor, sizeof(byte) * wRect);
 	
 	for (int i = 0; i < lRect; i++) {
 		for (int j = 0; j < wRect; j++) {
 			if (j < wShaded) {
-				buffer[i * wRect + j] = 1;
+				buffer[i * wRect + j] = barColor;
 			}
 		}
-		buffer[i * wRect + 0] = 1;
-		buffer[i * wRect + wRect - 1] = 1;
+		buffer[i * wRect + 0] = barColor;
+		buffer[i * wRect + wRect - 1] = barColor;
 	}
 	g_system->copyRectToScreen(buffer, wRect, pt.x, pt.y, wRect, lRect);
 	g_system->updateScreen();

Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-07-25 20:41:23 UTC (rev 51283)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/testsuite.h	2010-07-25 20:50:59 UTC (rev 51284)
@@ -36,7 +36,8 @@
 enum {
 	kColorBlack = 0,
 	kColorWhite = 1,
-	kColorCustom = 2
+	kColorCustom = 2,
+	kColorSpecial = 5 	///< some random number
 };
 
 enum OptionSelected {
@@ -104,6 +105,12 @@
 	static void displayMessage(const Common::String &textToDisplay, const char *defaultButton = "OK", const char *altButton = 0);
 	static Common::Rect writeOnScreen(const Common::String &textToDisplay, const Common::Point &pt, bool flag = false);
 	static void clearScreen(const Common::Rect &rect);
+	static void clearEntireScreen() {
+		const int width = g_system->getWidth();
+		const int height = g_system->getHeight();
+		Common::Rect r(0, 0, width, height);
+		clearScreen(r);
+	}
 	static void clearScreen();
 	static void clearScreen(bool flag);
 


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