missing updates

svn path=/trunk/; revision=1187
This commit is contained in:
Jason Filby 2000-06-16 20:58:56 +00:00
parent efd7fbb22e
commit ea1da2be56
2 changed files with 251 additions and 0 deletions

View file

@ -0,0 +1,88 @@
typedef struct tagFLOAT_POINT
{
FLOAT x, y;
} FLOAT_POINT;
/* Rounds a floating point number to integer. The world-to-viewport
* transformation process is done in floating point internally. This function
* is then used to round these coordinates to integer values.
*/
static inline INT GDI_ROUND(FLOAT val)
{
return (int)floor(val + 0.5);
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in floating point format).
*/
static inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
/* Perform the transformation */
x = point->x;
y = point->y;
point->x = x * dc->w.xformWorld2Vport.eM11 +
y * dc->w.xformWorld2Vport.eM21 +
dc->w.xformWorld2Vport.eDx;
point->y = x * dc->w.xformWorld2Vport.eM12 +
y * dc->w.xformWorld2Vport.eM22 +
dc->w.xformWorld2Vport.eDy;
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in integer format). Returns TRUE if successful, else FALSE.
*/
static inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)point->x;
floatPoint.y=(FLOAT)point->y;
if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
return FALSE;
/* Round to integers */
point->x = GDI_ROUND(floatPoint.x);
point->y = GDI_ROUND(floatPoint.y);
return TRUE;
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in integer format).
*/
static inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)point->x;
floatPoint.y=(FLOAT)point->y;
INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
/* Round to integers */
point->x = GDI_ROUND(floatPoint.x);
point->y = GDI_ROUND(floatPoint.y);
}
#define XDPTOLP(dc,x) \
(MulDiv(((x)-(dc)->vportOrgX), (dc)->wndExtX, (dc)->vportExtX) + (dc)->wndOrgX)
#define YDPTOLP(dc,y) \
(MulDiv(((y)-(dc)->vportOrgY), (dc)->wndExtY, (dc)->vportExtY) + (dc)->wndOrgY)
#define XLPTODP(dc,x) \
(MulDiv(((x)-(dc)->wndOrgX), (dc)->vportExtX, (dc)->wndExtX) + (dc)->vportOrgX)
#define YLPTODP(dc,y) \
(MulDiv(((y)-(dc)->wndOrgY), (dc)->vportExtY, (dc)->wndExtY) + (dc)->vportOrgY)
/* Device <-> logical size conversion */
#define XDSTOLS(dc,x) \
MulDiv((x), (dc)->wndExtX, (dc)->vportExtX)
#define YDSTOLS(dc,y) \
MulDiv((y), (dc)->wndExtY, (dc)->vportExtY)
#define XLSTODS(dc,x) \
MulDiv((x), (dc)->vportExtX, (dc)->wndExtX)
#define YLSTODS(dc,y) \
MulDiv((y), (dc)->vportExtY, (dc)->wndExtY)

View file

@ -0,0 +1,163 @@
/*
* math.h
*
* Mathematical functions.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: jfilby $
* $Date: 2000/06/16 20:58:56 $
*
*/
// added modfl
#ifndef _MATH_H_
#define _MATH_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* HUGE_VAL is returned by strtod when the value would overflow the
* representation of 'double'. There are other uses as well.
*
* __imp__HUGE is a pointer to the actual variable _HUGE in
* MSVCRT.DLL. If we used _HUGE directly we would get a pointer
* to a thunk function.
*
* NOTE: The CRTDLL version uses _HUGE_dll instead.
*/
#if __MSVCRT__
extern double* __imp__HUGE;
#define HUGE_VAL (*__imp__HUGE)
#else
/* CRTDLL */
extern double* _HUGE_dll;
#define HUGE_VAL (*_HUGE_dll)
#endif
#define M_PI 22 / 7
#define M_PI_2 M_PI * 2
struct _exception
{
int type;
char *name;
double arg1;
double arg2;
double retval;
};
/*
* Types for the above _exception structure.
*/
#define _DOMAIN 1 /* domain error in argument */
#define _SING 2 /* singularity */
#define _OVERFLOW 3 /* range overflow */
#define _UNDERFLOW 4 /* range underflow */
#define _TLOSS 5 /* total loss of precision */
#define _PLOSS 6 /* partial loss of precision */
/*
* Exception types with non-ANSI names for compatibility.
*/
#ifndef __STRICT_ANSI__
#ifndef _NO_OLDNAMES
#define DOMAIN _DOMAIN
#define SING _SING
#define OVERFLOW _OVERFLOW
#define UNDERFLOW _UNDERFLOW
#define TLOSS _TLOSS
#define PLOSS _PLOSS
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */
double sin (double x);
double cos (double x);
double tan (double x);
double sinh (double x);
double cosh (double x);
double tanh (double x);
double asin (double x);
double acos (double x);
double atan (double x);
double atan2 (double y, double x);
double exp (double x);
double log (double x);
double log10 (double x);
double pow (double x, double y);
long double powl (long double x,long double y);
double sqrt (double x);
double ceil (double x);
double floor (double x);
double fabs (double x);
double ldexp (double x, int n);
double frexp (double x, int* exp);
double modf (double x, double* ip);
long double modfl (long double x,long double* ip);
double fmod (double x, double y);
#ifndef __STRICT_ANSI__
/* Complex number (for cabs) */
struct _complex
{
double x; /* Real part */
double y; /* Imaginary part */
};
double _cabs (struct _complex x);
double _hypot (double x, double y);
double _j0 (double x);
double _j1 (double x);
double _jn (int n, double x);
double _y0 (double x);
double _y1 (double x);
double _yn (int n, double x);
#ifndef _NO_OLDNAMES
/*
* Non-underscored versions of non-ANSI functions. These reside in
* liboldnames.a. Provided for extra portability.
*/
double cabs (struct _complex x);
double hypot (double x, double y);
double j0 (double x);
double j1 (double x);
double jn (int n, double x);
double y0 (double x);
double y1 (double x);
double yn (int n, double x);
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#endif /* Not _MATH_H_ */