[Scummvm-cvs-logs] SF.net SVN: scummvm: [31863] scummvm/branches/gsoc2008-gui/graphics/ VectorRenderer.cpp

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Sun May 4 15:53:23 CEST 2008


Revision: 31863
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31863&view=rev
Author:   Tanoku
Date:     2008-05-04 06:53:22 -0700 (Sun, 04 May 2008)

Log Message:
-----------
Performance tweaks.

Modified Paths:
--------------
    scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-05-04 13:36:41 UTC (rev 31862)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-05-04 13:53:22 UTC (rev 31863)
@@ -34,7 +34,7 @@
 inline uint32 fp_sqroot(uint32 x);
 
 VectorRenderer *createRenderer() {
-	return new VectorRendererSpec<uint16, ColorMasks<565> >;
+	return new VectorRendererAA<uint16, ColorMasks<565> >;
 }
 
 
@@ -58,13 +58,12 @@
 	_system->showOverlay();
 
 	while (true) { // draw!!
-
 		vr->setColor(255, 255, 255);
 		vr->fillSurface();
 		vr->setColor(255, 0, 0 );
 		vr->drawLine(25, 25, 125, 300);
 		vr->drawCircle(250, 250, 100);
-		vr->drawSquare(150, 150, 100, 100, false);
+		vr->drawSquare(150, 25, 100, 100, true);
 		_system->copyRectToOverlay((OverlayColor*)_screen.getBasePtr(0, 0), _screen.w, 0, 0, _screen.w, _screen.w);
 		_system->updateScreen();
 		_system->delayMillis(100);
@@ -167,6 +166,7 @@
 	int pitch = Base::surfacePitch();
 	int xdir = (x2 > x1) ? 1 : -1;
 	uint16 error_tmp, error_acc, gradient;
+	uint8 alpha;
 
 	*ptr = (PixelType)Base::_color;
 
@@ -182,9 +182,10 @@
 				ptr += pitch;
 
 			ptr += xdir;
+			alpha = (error_acc >> 8);
 
-			blendPixelPtr(ptr, (error_acc >> 8) ^ 0xFF);
-			blendPixelPtr(ptr + pitch, (error_acc >> 8) & 0xFF);
+			blendPixelPtr(ptr, ~alpha);
+			blendPixelPtr(ptr + pitch, alpha);
 		}
 	} else {
 		gradient = (uint32)(dx << 16) / (uint32)dy;
@@ -198,9 +199,10 @@
 				ptr += xdir;
 
 			ptr += pitch;
+			alpha = (error_acc >> 8);
 
-			blendPixelPtr(ptr, (error_acc >> 8) ^ 0xFF);
-			blendPixelPtr(ptr + xdir, (error_acc >> 8) & 0xFF);
+			blendPixelPtr(ptr, ~alpha);
+			blendPixelPtr(ptr + xdir, alpha);
 		}
 	}
 
@@ -264,7 +266,7 @@
 		remHI = (remHI << 2) | (remLO >> 30);
 		remLO <<= 2;
 		root <<= 1;
-		testDIV = (root <<1 ) + 1;
+		testDIV = (root << 1 ) + 1;
 
 		if (remHI >= testDIV) {
 			remHI -= testDIV;
@@ -330,6 +332,7 @@
 	int y = 0;
 	uint32 rsq = (r * r) << 16;
 	uint32 T = 0, oldT;
+	uint8 a1, a2;
 	
 	__WU_CIRCLE_SIM(x, y, 255);
 
@@ -341,8 +344,11 @@
 		if (T < oldT)
 			x--;
 
-		__WU_CIRCLE_SIM(x,   y, (T >> 8) ^ 0xFF);
-		__WU_CIRCLE_SIM(x-1, y, (T >> 8) & 0xFF);
+		a2 = (T >> 8);
+		a1 = ~a2;
+
+		__WU_CIRCLE_SIM(x,   y, a1);
+		__WU_CIRCLE_SIM(x-1, y, a2);
 	}
 }
 


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