ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 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

gdifloat.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 typedef struct tagFLOAT_POINT
00004 {
00005    FLOAT x, y;
00006 } FLOAT_POINT;
00007 
00008 /* Rounds a floating point number to integer. The world-to-viewport
00009  * transformation process is done in floating point internally. This function
00010  * is then used to round these coordinates to integer values.
00011  */
00012 static __inline INT GDI_ROUND(FLOAT val)
00013 {
00014    return (int)floor(val + 0.5);
00015 }
00016 
00017 
00018 /* FIXME: Do not use the fpu in kernel on x86, use FLOATOBJ_Xxx api instead
00019  * Performs a world-to-viewport transformation on the specified point (which
00020  * is in floating point format).
00021  */
00022 static __inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
00023 {
00024     FLOAT x, y;
00025     XFORM xformWorld2Vport;
00026     
00027     MatrixS2XForm(&xformWorld2Vport, &dc->dclevel.mxWorldToDevice);
00028 
00029     /* Perform the transformation */
00030     x = point->x;
00031     y = point->y;
00032     point->x = x * xformWorld2Vport.eM11 +
00033                y * xformWorld2Vport.eM21 +
00034               xformWorld2Vport.eDx;
00035 
00036     point->y = x * xformWorld2Vport.eM12 +
00037                y * xformWorld2Vport.eM22 +
00038               xformWorld2Vport.eDy;
00039 }
00040 
00041 /* Performs a viewport-to-world transformation on the specified point (which
00042  * is in integer format). Returns TRUE if successful, else FALSE.
00043  */
00044 #if 0
00045 static __inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
00046 {
00047     FLOAT_POINT floatPoint;
00048 
00049     /* Perform operation with floating point */
00050     floatPoint.x=(FLOAT)point->x;
00051     floatPoint.y=(FLOAT)point->y;
00052     if (!INTERNAL_DPTOLP_FLOAT(dc, &floatPoint))
00053         return FALSE;
00054 
00055     /* Round to integers */
00056     point->x = GDI_ROUND(floatPoint.x);
00057     point->y = GDI_ROUND(floatPoint.y);
00058 
00059     return TRUE;
00060 }
00061 
00062 /* Performs a world-to-viewport transformation on the specified point (which
00063  * is in integer format).
00064  */
00065 static __inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
00066 {
00067     FLOAT_POINT floatPoint;
00068 
00069     /* Perform operation with floating point */
00070     floatPoint.x=(FLOAT)point->x;
00071     floatPoint.y=(FLOAT)point->y;
00072     INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
00073 
00074     /* Round to integers */
00075     point->x = GDI_ROUND(floatPoint.x);
00076     point->y = GDI_ROUND(floatPoint.y);
00077 }
00078 
00079 #endif
00080 
00081 #define MulDiv( x, y, z ) EngMulDiv( x, y, z )
00082 
00083 #define XDPTOLP(pdcattr,tx) \
00084     (MulDiv(((tx)-(pdcattr)->ptlViewportOrg.x), (pdcattr)->szlWindowExt.cx, (pdcattr)->szlViewportExt.cx) + (pdcattr)->ptlWindowOrg.x)
00085 #define YDPTOLP(pdcattr,ty) \
00086     (MulDiv(((ty)-(pdcattr)->ptlViewportOrg.y), (pdcattr)->szlWindowExt.cy, (pdcattr)->szlViewportExt.cy) + (pdcattr)->ptlWindowOrg.y)
00087 #define XLPTODP(pdcattr,tx) \
00088     (MulDiv(((tx)-(pdcattr)->ptlWindowOrg.x), (pdcattr)->szlViewportExt.cx, (pdcattr)->szlWindowExt.cx) + (pdcattr)->ptlViewportOrg.x)
00089 #define YLPTODP(pdcattr,ty) \
00090     (MulDiv(((ty)-(pdcattr)->ptlWindowOrg.y), (pdcattr)->szlViewportExt.cy, (pdcattr)->szlWindowExt.cy) + (pdcattr)->ptlViewportOrg.y)
00091 
00092   /* Device <-> logical size conversion */
00093 
00094 #define XDSTOLS(pdcattr,tx) \
00095     MulDiv((tx), (pdcattr)->szlWindowExt.cx, (pdcattr)->szlViewportExt.cx)
00096 #define YDSTOLS(DC_Attr,ty) \
00097     MulDiv((ty), (pdcattr)->szlWindowExt.cy, (pdcattr)->szlViewportExt.cy)
00098 #define XLSTODS(pdcattr,tx) \
00099     MulDiv((tx), (pdcattr)->szlViewportExt.cx, (pdcattr)->szlWindowExt.cx)
00100 #define YLSTODS(pdcattr,ty) \
00101     MulDiv((ty), (pdcattr)->szlViewportExt.cy, (pdcattr)->szlWindowExt.cy)

Generated on Sun May 27 2012 04:38:26 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.