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

Tanoku at users.sourceforge.net Tanoku at users.sourceforge.net
Sun May 4 01:51:25 CEST 2008


Revision: 31854
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31854&view=rev
Author:   Tanoku
Date:     2008-05-03 16:51:24 -0700 (Sat, 03 May 2008)

Log Message:
-----------
Rectangle drawing.

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

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-05-03 23:10:43 UTC (rev 31853)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp	2008-05-03 23:51:24 UTC (rev 31854)
@@ -64,7 +64,7 @@
 		vr->setColor(255, 0, 0 );
 		vr->drawLine(25, 25, 125, 300);
 		vr->drawCircle(250, 250, 100);
-
+		vr->drawSquare(150, 150, 100, 100, false);
 		_system->copyRectToOverlay((OverlayColor*)_screen.getBasePtr(0, 0), _screen.w, 0, 0, _screen.w, _screen.w);
 		_system->updateScreen();
 		_system->delayMillis(100);
@@ -75,6 +75,25 @@
 
 template<typename PixelType, typename PixelFormat>
 void VectorRendererSpec<PixelType, PixelFormat>::
+drawSquare(int x, int y, int w, int h, bool fill) {
+	if ( fill ) {
+		PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x, y);
+		int pitch = surfacePitch();
+
+		while (h--) {
+			Common::set_to(ptr, ptr + w, (PixelType)_color);
+			ptr += pitch;
+		}
+	} else {
+		drawLine( x, y, x + w, y );
+		drawLine( x + w, y, x + w, y + w );
+		drawLine( x, y + w, x + w, y + w );
+		drawLine( x, y, x, y + w );
+	}
+}
+
+template<typename PixelType, typename PixelFormat>
+void VectorRendererSpec<PixelType,PixelFormat>::
 drawLineAlg(int x1, int y1, int x2, int y2, int dx, int dy) {
 	PixelType *ptr = (PixelType *)_activeSurface->getBasePtr(x1, y1);
 	int pitch = surfacePitch();

Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-05-03 23:10:43 UTC (rev 31853)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h	2008-05-03 23:51:24 UTC (rev 31854)
@@ -74,6 +74,9 @@
 	 */
 	virtual void drawCircle(int x, int y, int r) = 0;
 
+
+	virtual void drawSquare(int x, int y, int w, int h, bool fill) = 0;
+
 	/**
 	 * Gets the pixel pitch for the current drawing surface.
 	 * Note: This is a real pixel-pitch, not a byte-pitch.
@@ -206,12 +209,14 @@
 	/**
 	 * @see VectorRenderer::drawLine()
 	 */
-	void drawLine(int x1, int x2, int y1, int y2);
+	void drawLine(int x1, int y1, int x2, int y2);
 
 	void drawCircle(int x, int y, int r) {
 		drawCircleAlg(x, y, r);
 	}
 
+	void drawSquare(int x, int y, int w, int h, bool fill);
+
 	/**
 	 * @see VectorRenderer::setColor()
 	 */


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