Added port of LineDDA function from WINE.

svn path=/trunk/; revision=6671
This commit is contained in:
Steven Edwards 2003-11-16 22:44:39 +00:00
parent 03600c758d
commit 8da4aa2712
3 changed files with 83 additions and 22 deletions

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.34 2003/11/15 15:18:05 weiden Exp $
# $Id: makefile,v 1.35 2003/11/16 22:44:39 sedwards Exp $
PATH_TO_TOP = ../..
@ -39,6 +39,7 @@ OBJECTS_OBJECTS = \
objects/dc.o \
objects/fillshap.o \
objects/line.o \
objects/linedda.o \
objects/metafile.o \
objects/pen.o \
objects/region.o \

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.39 2003/11/08 22:54:26 navaraf Exp $
/* $Id: stubs.c,v 1.40 2003/11/16 22:44:39 sedwards Exp $
*
* reactos/lib/gdi32/misc/stubs.c
*
@ -513,26 +513,6 @@ InvertRgn(
return FALSE;
}
/*
* @unimplemented
*/
BOOL
STDCALL
LineDDA(
int a0,
int a1,
int a2,
int a3,
LINEDDAPROC a4,
LPARAM a5
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*
* @unimplemented
*/

View file

@ -0,0 +1,80 @@
/*
* LineDDA
*
* Copyright 1993 Bob Amstadt
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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
*/
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS GDI32
* PURPOSE: LineDDA Function
* FILE: lib/gdi32/objects/linedda.c
* PROGRAMER: Steven Edwards
* REVISION HISTORY: 2003/11/15 sedwards Created
* NOTES: Adapted from Wine
*/
#include <windows.h>
#include <ddk/ntddk.h>
#include <win32k/kapi.h>
#include <debug.h>
/**********************************************************************
* LineDDA (GDI32.@)
* @implemented
*/
BOOL STDCALL LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd,
LINEDDAPROC callback, LPARAM lParam )
{
INT xadd = 1, yadd = 1;
INT err,erradd;
INT cnt;
INT dx = nXEnd - nXStart;
INT dy = nYEnd - nYStart;
if (dx < 0) {
dx = -dx; xadd = -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++) {
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;
}