[Scummvm-cvs-logs] SF.net SVN: scummvm: [31832] scummvm/branches/gsoc2008-gui

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Fri May 2 19:53:22 CEST 2008


Revision: 31832
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31832&view=rev
Author:   Tanoku
Date:     2008-05-02 10:53:21 -0700 (Fri, 02 May 2008)

Log Message:
-----------
Renderer test function in main.cpp

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

Modified: scummvm/branches/gsoc2008-gui/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/base/main.cpp	2008-05-02 17:14:59 UTC (rev 31831)
+++ scummvm/branches/gsoc2008-gui/base/main.cpp	2008-05-02 17:53:21 UTC (rev 31832)
@@ -43,7 +43,11 @@
 #include "gui/newgui.h"
 #include "gui/message.h"
 
-#if defined(_WIN32_WCE)
+#define _VECTOR_RENDERER_DBG 1
+
+#if defined(_VECTOR_RENDERER_DBG)
+#include "graphics/VectorRenderer.h"
+#elif defined(_WIN32_WCE)
 #include "backends/platform/wince/CELauncherDialog.h"
 #elif defined(__DC__)
 #include "backends/platform/dc/DCLauncherDialog.h"
@@ -67,6 +71,13 @@
 	// Clear the main screen
 	system.clearScreen();
 
+#if defined(_VECTOR_RENDERER_DBG)
+
+	Graphics::vector_renderer_test( &system );
+	return true;
+
+#else
+
 #if defined(_WIN32_WCE)
 	CELauncherDialog dlg;
 #elif defined(__DC__)
@@ -75,6 +86,8 @@
 	GUI::LauncherDialog dlg;
 #endif
 	return (dlg.runModal() != -1);
+
+#endif // vector renderer debug
 }
 
 static const Plugin *detectPlugin() {

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-05-02 17:14:59 UTC (rev 31831)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-05-02 17:53:21 UTC (rev 31832)
@@ -27,13 +27,43 @@
 #include "graphics/surface.h"
 #include "graphics/VectorRenderer.h"
 #include "graphics/colormasks.h"
+#include "common/system.h"
 
 namespace Graphics {
 
 VectorRenderer *createRenderer() {
-	return new VectorRendererAA<uint16,ColorMasks<565>>;
+	return new VectorRendererSpec<uint16,ColorMasks<565>>;
 }
 
+
+void vector_renderer_test( OSystem *_system ) {
+	VectorRenderer *vr = createRenderer();
+
+	Surface _screen;
+	_screen.create(_system->getOverlayWidth(), _system->getOverlayHeight(), sizeof(OverlayColor));
+
+	if (!_screen.pixels)
+		return;
+
+	_system->clearOverlay();
+	_system->grabOverlay((OverlayColor*)_screen.pixels, _screen.w);
+
+	vr->setSurface( &_screen );
+	vr->setColor( 255, 255, 255 );
+
+	_system->showOverlay();
+
+	while( true ) { // draw!!
+		vr->drawLine( 25, 100, 25, 150 );
+		_system->copyRectToOverlay((OverlayColor*)_screen.getBasePtr(0, 0), _screen.w, 0, 0, _screen.w, _screen.w);
+		_system->updateScreen();
+		_system->delayMillis(100);
+	}
+
+	_system->hideOverlay();
+}
+
+
 template<typename PixelType, typename PixelFormat>
 void VectorRendererSpec<PixelType,PixelFormat>::
 drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy) {
@@ -83,8 +113,7 @@
 
 template<typename PixelType, typename PixelFormat>
 void VectorRendererAA<PixelType,PixelFormat>::
-drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy)
-{
+drawLineAlg(int x1, int x2, int y1, int y2, int dx, int dy) {
 	PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x1, y1);
 	int pitch = surfacePitch();
 	int xdir = (x2 > x1) ? 1 : -1;

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-05-02 17:14:59 UTC (rev 31831)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-05-02 17:53:21 UTC (rev 31832)
@@ -28,9 +28,12 @@
 
 #include "common/scummsys.h"
 #include "graphics/surface.h"
+#include "common/system.h"
 
 namespace Graphics {
 
+void vector_renderer_test( OSystem *_system );
+
 /**
  * VectorRenderer: The core Vector Renderer Class
  *
@@ -104,6 +107,10 @@
 	 */
 	virtual void setColor(uint8 r, uint8 g, uint8 b, uint8 a) = 0;
 
+	virtual void setSurface( Surface *surface ){
+		_activeSurface = surface;
+	}
+
 protected:
 
 	/**


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