[Scummvm-cvs-logs] SF.net SVN: scummvm:[38813] scummvm/trunk/engines/sci/gfx/gfx_driver.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Feb 23 10:39:14 CET 2009


Revision: 38813
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38813&view=rev
Author:   thebluegr
Date:     2009-02-23 09:39:09 +0000 (Mon, 23 Feb 2009)

Log Message:
-----------
Replaced lineColor2 with Graphics::drawLine

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/gfx_driver.cpp

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-23 09:03:12 UTC (rev 38812)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-23 09:39:09 UTC (rev 38813)
@@ -26,6 +26,7 @@
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "common/events.h"
+#include "graphics/primitives.h"
 
 #include "sci/gfx/gfx_driver.h"
 #include "sci/gfx/gfx_tools.h"
@@ -113,47 +114,9 @@
 
 // Drawing operations
 
-// This code shamelessly lifted from the SDL_gfxPrimitives package
-static void lineColor2(byte *dst, int16 x1, int16 y1, int16 x2, int16 y2, uint32 color) {
-	int pixx, pixy;
-	int x, y;
-	int dx, dy;
-	int sx, sy;
-	int swaptmp;
-	uint8 *pixel;
-
-	dx = x2 - x1;
-	dy = y2 - y1;
-	sx = (dx >= 0) ? 1 : -1;
-	sy = (dy >= 0) ? 1 : -1;
-
-	dx = sx * dx + 1;
-	dy = sy * dy + 1;
-	pixx = 1;
-	pixy = 320;
-	pixel = ((uint8*)dst) + pixx * (int)x1 + pixy * (int)y1;
-	pixx *= sx;
-	pixy *= sy;
-	if (dx < dy) {
-		swaptmp = dx;
-		dx = dy;
-		dy = swaptmp;
-		swaptmp = pixx;
-		pixx = pixy;
-		pixy = swaptmp;
-	}
-
-	// Draw
-	x = 0;
-	y = 0;
-	for (; x < dx; x++, pixel += pixx) {
-		*pixel = color;
-		y += dy;
-		if (y >= dx) {
-			y -= dx;
-			pixel += pixy;
-		}
-	}
+static void drawProc(int x, int y, int c, void *data) {
+	uint8 *p = (uint8 *)data;
+	p[y * 320 + x] = c;
 }
 
 static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Point end,
@@ -170,7 +133,7 @@
 		nend.x = CLIP<int16>(end.x, 0, xsize - 1);
 		nend.y = CLIP<int16>(end.y, 0, ysize - 1);
 
-		lineColor2(S->visual[1], (int16)nstart.x, (int16)nstart.y, (int16)nend.x, (int16)nend.y, scolor);
+		Graphics::drawLine(nstart.x, nstart.y, nend.x, nend.y, scolor, drawProc, S->visual[1]);
 
 		if (color.mask & GFX_MASK_PRIORITY) {
 			gfx_draw_line_pixmap_i(S->priority[0], nstart, nend, color.priority);


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