ReactOS Fundraising Campaign 2012
 
€ 3,873 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

linedda.c
Go to the documentation of this file.
00001 /*
00002  * GDI drawing functions.
00003  *
00004  * Copyright 1993, 1994 Alexandre Julliard
00005  * Copyright 1997 Bertho A. Stultiens
00006  *           1999 Huw D M Davies
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00021  */
00022 /*
00023  * COPYRIGHT:        See COPYING in the top level directory
00024  * PROJECT:          ReactOS GDI32
00025  * PURPOSE:          LineDDA Function
00026  * FILE:             dll/win32/gdi32/objects/linedda.c
00027  * PROGRAMER:        Steven Edwards
00028  * REVISION HISTORY: 2003/11/15 sedwards Created, 2009/04 gschneider Updated
00029  * NOTES:            Adapted from Wine
00030  */
00031 
00032 #include "precomp.h"
00033 
00034 #include <debug.h>
00035 
00036 /**********************************************************************
00037  *           LineDDA   (GDI32.@)
00038  * @implemented
00039  */
00040 BOOL WINAPI LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd,
00041                     LINEDDAPROC callback, LPARAM lParam )
00042 {
00043     INT xadd = 1, yadd = 1;
00044     INT err,erradd;
00045     INT cnt;
00046     INT dx = nXEnd - nXStart;
00047     INT dy = nYEnd - nYStart;
00048 
00049     if (dx < 0)
00050     {
00051         dx = -dx;
00052         xadd = -1;
00053     }
00054     if (dy < 0)
00055     {
00056         dy = -dy;
00057         yadd = -1;
00058     }
00059     if (dx > dy)  /* line is "more horizontal" */
00060     {
00061         err = 2*dy - dx;
00062         erradd = 2*dy - 2*dx;
00063         for(cnt = 0; cnt < dx; cnt++)
00064         {
00065             callback(nXStart,nYStart,lParam);
00066             if (err > 0)
00067             {
00068                 nYStart += yadd;
00069                 err += erradd;
00070             }
00071             else err += 2*dy;
00072             nXStart += xadd;
00073         }
00074     }
00075     else   /* line is "more vertical" */
00076     {
00077         err = 2*dx - dy;
00078         erradd = 2*dx - 2*dy;
00079         for(cnt = 0; cnt < dy; cnt++)
00080         {
00081             callback(nXStart,nYStart,lParam);
00082             if (err > 0)
00083             {
00084                 nXStart += xadd;
00085                 err += erradd;
00086             }
00087             else err += 2*dx;
00088             nYStart += yadd;
00089         }
00090     }
00091     return TRUE;
00092 }
00093 

Generated on Sat May 19 2012 04:36:09 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.