Author: gschneider
Date: Sat Apr 11 00:39:05 2009
New Revision: 40448
URL:
http://svn.reactos.org/svn/reactos?rev=40448&view=rev
Log:
Update LineDDA implementation, -13 gdi32 path tests
Modified:
trunk/reactos/dll/win32/gdi32/objects/linedda.c
Modified: trunk/reactos/dll/win32/gdi32/objects/linedda.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/li…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/linedda.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/linedda.c [iso-8859-1] Sat Apr 11 00:39:05 2009
@@ -1,7 +1,9 @@
/*
- * LineDDA
+ * GDI drawing functions.
*
- * Copyright 1993 Bob Amstadt
+ * Copyright 1993, 1994 Alexandre Julliard
+ * Copyright 1997 Bertho A. Stultiens
+ * 1999 Huw D M Davies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -15,15 +17,15 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS GDI32
* PURPOSE: LineDDA Function
- * FILE: lib/gdi32/objects/linedda.c
+ * FILE: dll/win32/gdi32/objects/linedda.c
* PROGRAMER: Steven Edwards
- * REVISION HISTORY: 2003/11/15 sedwards Created
+ * REVISION HISTORY: 2003/11/15 sedwards Created, 2009/04 gschneider Updated
* NOTES: Adapted from Wine
*/
@@ -36,7 +38,7 @@
* @implemented
*/
BOOL WINAPI LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd,
- LINEDDAPROC lpLineFunc, LPARAM lpData )
+ LINEDDAPROC callback, LPARAM lParam )
{
INT xadd = 1, yadd = 1;
INT err,erradd;
@@ -44,73 +46,46 @@
INT dx = nXEnd - nXStart;
INT dy = nYEnd - nYStart;
- // optimized for vertical and horizontal lines so we avoid unnecessary math
- if(nXStart == nXEnd)
- {
- // vertical line - use dx,dy as temp variables so we don't waste stack space
- if(nYStart < nYEnd)
- {
- dx = nYStart;
- dy = nYEnd;
- } else {
- dx = nYEnd;
- dy = nYStart;
- }
- for(cnt = dx; cnt <= dy; cnt++)
- {
- lpLineFunc(nXStart,cnt,lpData);
- }
- return TRUE;
- }
-
- if(nYStart == nYEnd)
- {
- // horizontal line - use dx,dy as temp variables so we don't waste stack space
- if(nXStart < nXEnd)
- {
- dx = nXStart;
- dy = nXEnd;
- } else {
- dx = nXEnd;
- dy = nXStart;
- }
- for(cnt = dx; cnt <= dy; cnt++)
- {
- lpLineFunc(cnt, nYStart,lpData);
- }
- return TRUE;
- }
- // end of H/V line code
- if (dx < 0) {
- dx = -dx; xadd = -1;
+ if (dx < 0)
+ {
+ dx = -dx;
+ xadd = -1;
}
- if (dy < 0) {
- dy = -dy; yadd = -1;
+ if (dy < 0)
+ {
+ dy = -dy;
+ yadd = -1;
}
- if (dx > dy) { /* line is "more horizontal" */
- err = 2*dy - dx; erradd = 2*dy - 2*dx;
- for(cnt = 0;cnt <= dx; cnt++) {
- lpLineFunc(nXStart,nYStart,lpData);
- if (err > 0) {
- nYStart += yadd;
- err += erradd;
- } else {
- err += 2*dy;
- }
- nXStart += xadd;
- }
- } else { /* line is "more vertical" */
- err = 2*dx - dy; erradd = 2*dx - 2*dy;
- for(cnt = 0;cnt <= dy; cnt++) {
- lpLineFunc(nXStart,nYStart,lpData);
- if (err > 0) {
- nXStart += xadd;
- err += erradd;
- } else {
- err += 2*dx;
- }
- nYStart += yadd;
- }
+ if (dx > dy) /* line is "more horizontal" */
+ {
+ err = 2*dy - dx; erradd = 2*dy - 2*dx;
+ for(cnt = 0;cnt < dx; cnt++)
+ {
+ callback(nXStart,nYStart,lParam);
+ if (err > 0)
+ {
+ nYStart += yadd;
+ err += erradd;
+ }
+ else err += 2*dy;
+ nXStart += xadd;
+ }
+ }
+ else /* line is "more vertical" */
+ {
+ err = 2*dx - dy; erradd = 2*dx - 2*dy;
+ for(cnt = 0;cnt < dy; cnt++)
+ {
+ callback(nXStart,nYStart,lParam);
+ if (err > 0)
+ {
+ nXStart += xadd;
+ err += erradd;
+ }
+ else err += 2*dx;
+ nYStart += yadd;
+ }
}
return TRUE;
}
+