[Scummvm-cvs-logs] SF.net SVN: scummvm:[49593] scummvm/branches/gsoc2010-testbed/engines/ testbed/graphics.cpp
sud03r at users.sourceforge.net
sud03r at users.sourceforge.net
Fri Jun 11 12:44:33 CEST 2010
Revision: 49593
http://scummvm.svn.sourceforge.net/scummvm/?rev=49593&view=rev
Author: sud03r
Date: 2010-06-11 10:44:32 +0000 (Fri, 11 Jun 2010)
Log Message:
-----------
added code for ellipse drawing (Aspect ratio correction), fixed some more formatting
Modified Paths:
--------------
scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
Modified: scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp 2010-06-11 09:17:11 UTC (rev 49592)
+++ scummvm/branches/gsoc2010-testbed/engines/testbed/graphics.cpp 2010-06-11 10:44:32 UTC (rev 49593)
@@ -19,10 +19,10 @@
g_system->grabPalette(_palette, 0, 3);
// Add tests here
- addTest("FullScreenMode", &GFXtests::fullScreenMode);
+ // addTest("FullScreenMode", &GFXtests::fullScreenMode);
addTest("AspectRatio", &GFXtests::aspectRatio);
- addTest("PalettizedCursors", &GFXtests::palettizedCursors);
- addTest("BlitBitmaps", &GFXtests::copyRectToScreen);
+ // addTest("PalettizedCursors", &GFXtests::palettizedCursors);
+ // addTest("BlitBitmaps", &GFXtests::copyRectToScreen);
}
const char *GFXTestSuite::getName() {
@@ -56,12 +56,54 @@
// GFXtests go here
+void drawEllipse(int cx, int cy, int a, int b) {
+ byte buffer[100][100] = {0};
+ int shift = 25;
+ // Assume a rectangle of 50x50
+ // horizontal axis = y-axis
+ // vertical axis = x-axis
+ // The centre is (shift, shift). As of now assume it to be (0, 0)
+ // and when done shift it to (shift, shift)
+ float theta;
+ int x, y, x1, y1;
+
+ for (theta = 0; theta <= PI / 2; theta += PI / 90 ) {
+ x = (int)(b * sin(theta) + 0.5);
+ y = (int)(a * cos(theta) + 0.5);
+
+ // This gives us four points
+
+ x1 = x + shift;
+ y1 = y + shift;
+
+ buffer[x1][y1] = 1;
+
+ x1 = (-1) * x + shift;
+ y1 = y + shift;
+
+ buffer[x1][y1] = 1;
+
+ x1 = x + shift;
+ y1 = (-1) * y + shift;
+
+ buffer[x1][y1] = 1;
+
+ x1 = (-1) * x + shift;
+ y1 = (-1) * y + shift;
+
+ buffer[x1][y1] = 1;
+ }
+
+ g_system->copyRectToScreen(&buffer[0][0], 100, cx, cy, 100, 100);
+ g_system->updateScreen();
+}
+
bool GFXtests::fullScreenMode() {
- Testsuite::displayMessage("Testing fullscreen mode. \n \
- If the feature is supported by the backend, you should expect to see a toggle between fullscreen and normal modes");
+ Testsuite::displayMessage("Testing fullscreen mode.\n"
+ "If the feature is supported by the backend, you should expect to see a toggle between fullscreen and normal modes");
- Common::Point pt(0,100);
+ Common::Point pt(0, 100);
Common::Rect rect = Testsuite::writeOnScreen("Testing fullscreen mode", pt);
bool isFeaturePresent;
@@ -95,8 +137,11 @@
bool GFXtests::aspectRatio() {
Testsuite::displayMessage("Testing Aspect Ratio Correction.\n"
"With this feature enabled games running at 320x200 should be scaled upto 320x240 pixels");
+
+ // Draw an ellipse
+ drawEllipse(25, 25, 24, 20);
- Common::Point pt(0,100);
+ Common::Point pt(0, 100);
Common::Rect rect = Testsuite::writeOnScreen("Testing Aspect ratio correction", pt);
bool isFeaturePresent;
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