Commit 5ee1599d authored by Alexandre Julliard's avatar Alexandre Julliard

Replaced LPTODP/DPTOLP macros by calls to LPtoDP/DPtoLP (with the help

of Huw Davies).
parent 3a99d8ba
......@@ -36,10 +36,12 @@ WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y )
DC *dc = physDev->dc;
POINT16 points[2];
points[0].x = physDev->org.x + XLPTODP( dc, dc->CursPosX );
points[0].y = physDev->org.y + YLPTODP( dc, dc->CursPosY );
points[1].x = physDev->org.x + XLPTODP( dc, x );
points[1].y = physDev->org.y + YLPTODP( dc, y );
points[0].x = dc->CursPosX;
points[0].y = dc->CursPosY;
points[1].x = x;
points[1].y = y;
LPtoDP16( physDev->hdc, points, 2 );
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_POLYLINE, 2, points,
physDev->PenInfo,
......@@ -63,15 +65,15 @@ WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL bRet = 0;
POINT16 points[2];
TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %ld y %ld\n",
left, top, physDev->org.x, physDev->org.y);
TRACE("In WIN16DRV_Rectangle, x %d y %d\n", left, top );
TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top);
points[0].x = left;
points[0].y = top;
points[1].x = right;
points[1].y = bottom;
LPtoDP16( physDev->hdc, points, 2 );
points[1].x = XLPTODP(dc, right);
points[1].y = YLPTODP(dc, bottom);
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_RECTANGLE, 2, points,
physDev->PenInfo,
......@@ -104,9 +106,10 @@ WIN16DRV_Polygon(PHYSDEV dev, const POINT* pt, INT count )
for (i = 0; i < count - 1; i++)
{
points[i].x = XLPTODP( dc, pt[i].x );
points[i].y = YLPTODP( dc, pt[i].y );
points[i].x = pt[i].x;
points[i].y = pt[i].y;
}
LPtoDP16( physDev->hdc, points, count-1 );
points[count-1].x = points[0].x;
points[count-1].y = points[0].y;
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
......@@ -138,9 +141,10 @@ WIN16DRV_Polyline(PHYSDEV dev, const POINT* pt, INT count )
for (i = 0; i < count; i++)
{
points[i].x = XLPTODP( dc, pt[i].x );
points[i].y = YLPTODP( dc, pt[i].y );
points[i].x = pt[i].x;
points[i].y = pt[i].y;
}
LPtoDP16( physDev->hdc, points, count );
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_POLYLINE, count, points,
physDev->PenInfo,
......@@ -163,14 +167,14 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL bRet = 0;
POINT16 points[2];
TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %ld y %ld\n",
left, top, physDev->org.x, physDev->org.y);
TRACE("In WIN16DRV_Ellipse, x %d y %d\n", left, top );
TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top);
points[1].x = XLPTODP(dc, right);
points[1].y = YLPTODP(dc, bottom);
points[0].x = left;
points[0].y = top;
points[1].x = right;
points[1].y = bottom;
LPtoDP16( physDev->hdc, points, 2 );
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_ELLIPSE, 2, points,
......
......@@ -258,7 +258,6 @@ BOOL WIN16DRV_CreateDC( DC *dc, PHYSDEV *pdev, LPCSTR driver, LPCSTR device, LPC
*pdev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
physDev->org.x = physDev->org.y = 0;
pLPD = LoadPrinterDriver(driver);
if (pLPD == NULL)
......
......@@ -43,6 +43,7 @@ BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
RECT16 *lpOpaqueRect = NULL;
WORD wOptions = 0;
DWORD len;
POINT pt;
INT16 width;
char *str;
DWORD dwRet;
......@@ -77,8 +78,11 @@ BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
y = dc->CursPosY;
}
x = XLPTODP( dc, x );
y = YLPTODP( dc, y );
pt.x = x;
pt.y = y;
LPtoDP( physDev->hdc, &pt, 1 );
x = pt.x;
y = pt.y;
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
NULL, str, -len, physDev->FontInfo,
......@@ -91,12 +95,22 @@ BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
case TA_LEFT:
if (dc->textAlign & TA_UPDATECP)
dc->CursPosX = XDPTOLP( dc, x + width );
{
pt.x = x + width;
pt.y = y;
DPtoLP( physDev->hdc, &pt, 1 );
dc->CursPosX = pt.x;
}
break;
case TA_RIGHT:
x -= width;
if (dc->textAlign & TA_UPDATECP)
dc->CursPosX = XDPTOLP( dc, x );
if (dc->textAlign & TA_UPDATECP)
{
pt.x = x;
pt.y = y;
DPtoLP( physDev->hdc, &pt, 1 );
dc->CursPosX = pt.x;
}
break;
case TA_CENTER:
x -= width / 2;
......@@ -123,12 +137,3 @@ BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
HeapFree( GetProcessHeap(), 0, str );
return bRet;
}
......@@ -207,7 +207,6 @@ typedef struct
LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */
HDC hdc;
DC *dc;
POINT org; /* Device origin */
DeviceCaps DevCaps; /* Device caps */
} WIN16DRV_PDEVICE;
......
......@@ -148,8 +148,13 @@ static BOOL PSDRV_Text(PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags, LPCWSTR
TRACE("textAlign = %x\n", align);
switch(align & (TA_LEFT | TA_CENTER | TA_RIGHT) ) {
case TA_LEFT:
if(align & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP(dc, x + sz.cx, y);
if(align & TA_UPDATECP)
{
POINT pt;
pt.x = x + sz.cx;
pt.y = y;
DPtoLP( physDev->hdc, &pt, 1 );
dc->CursPosX = pt.x;
}
break;
......@@ -159,8 +164,13 @@ static BOOL PSDRV_Text(PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags, LPCWSTR
case TA_RIGHT:
x -= sz.cx;
if(align & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP(dc, x, y);
if(align & TA_UPDATECP)
{
POINT pt;
pt.x = x;
pt.y = y;
DPtoLP( physDev->hdc, &pt, 1 );
dc->CursPosX = pt.x;
}
break;
}
......
......@@ -58,8 +58,8 @@ BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count )
while (count--)
{
points->x = XDPTOLP( dc, points->x );
points->y = YDPTOLP( dc, points->y );
points->x = MulDiv( points->x - dc->vportOrgX, dc->wndExtX, dc->vportExtX ) + dc->wndOrgX;
points->y = MulDiv( points->y - dc->vportOrgY, dc->wndExtY, dc->vportExtY ) + dc->wndOrgY;
points++;
}
GDI_ReleaseObj( hdc );
......@@ -75,11 +75,20 @@ BOOL WINAPI DPtoLP( HDC hdc, LPPOINT points, INT count )
DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE;
while (count--)
if (dc->vport2WorldValid)
{
if (!INTERNAL_DPTOLP( dc, points ))
break;
points++;
while (count--)
{
FLOAT x = points->x;
FLOAT y = points->y;
points->x = floor( x * dc->xformVport2World.eM11 +
y * dc->xformVport2World.eM21 +
dc->xformVport2World.eDx + 0.5 );
points->y = floor( x * dc->xformVport2World.eM12 +
y * dc->xformVport2World.eM22 +
dc->xformVport2World.eDy + 0.5 );
points++;
}
}
GDI_ReleaseObj( hdc );
return (count < 0);
......@@ -96,8 +105,8 @@ BOOL16 WINAPI LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count )
while (count--)
{
points->x = XLPTODP( dc, points->x );
points->y = YLPTODP( dc, points->y );
points->x = MulDiv( points->x - dc->wndOrgX, dc->vportExtX, dc->wndExtX ) + dc->vportOrgX;
points->y = MulDiv( points->y - dc->wndOrgY, dc->vportExtY, dc->wndExtY ) + dc->vportOrgY;
points++;
}
GDI_ReleaseObj( hdc );
......@@ -115,7 +124,14 @@ BOOL WINAPI LPtoDP( HDC hdc, LPPOINT points, INT count )
while (count--)
{
INTERNAL_LPTODP( dc, points );
FLOAT x = points->x;
FLOAT y = points->y;
points->x = floor( x * dc->xformWorld2Vport.eM11 +
y * dc->xformWorld2Vport.eM21 +
dc->xformWorld2Vport.eDx + 0.5 );
points->y = floor( x * dc->xformWorld2Vport.eM12 +
y * dc->xformWorld2Vport.eM22 +
dc->xformWorld2Vport.eDy + 0.5 );
points++;
}
GDI_ReleaseObj( hdc );
......
......@@ -81,6 +81,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi);
#define GROW_FACTOR_NUMER 2 /* Numerator of grow factor for the array */
#define GROW_FACTOR_DENOM 1 /* Denominator of grow factor */
/* A floating point version of the POINT structure */
typedef struct tagFLOAT_POINT
{
FLOAT x, y;
} FLOAT_POINT;
static BOOL PATH_PathToRegion(GdiPath *pPath, INT nPolyFillMode,
HRGN *pHrgn);
......@@ -94,6 +100,23 @@ static void PATH_NormalizePoint(FLOAT_POINT corners[], const FLOAT_POINT
*pPoint, double *pX, double *pY);
static BOOL PATH_CheckCorners(DC *dc, POINT corners[], INT x1, INT y1, INT x2, INT y2);
/* Performs a world-to-viewport transformation on the specified point (which
* is in floating point format).
*/
static inline void WINE_UNUSED INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
/* Perform the transformation */
x = point->x;
y = point->y;
point->x = x * dc->xformWorld2Vport.eM11 +
y * dc->xformWorld2Vport.eM21 +
dc->xformWorld2Vport.eDx;
point->y = x * dc->xformWorld2Vport.eM12 +
y * dc->xformWorld2Vport.eM22 +
dc->xformWorld2Vport.eDy;
}
/***********************************************************************
* BeginPath (GDI.512)
......
......@@ -1224,6 +1224,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
const BYTE *opcode;
Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */
GC tmpGC = 0;
POINT pts[2];
DC *dcSrc = physDevSrc ? physDevSrc->dc : NULL;
DC *dcDst = physDevDst->dc;
......@@ -1244,12 +1245,15 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
/* Map the coordinates to device coords */
xDst = XLPTODP( dcDst, xDst );
yDst = YLPTODP( dcDst, yDst );
/* Here we have to round to integers, not truncate */
widthDst = MulDiv(widthDst, dcDst->vportExtX, dcDst->wndExtX);
heightDst = MulDiv(heightDst, dcDst->vportExtY, dcDst->wndExtY);
pts[0].x = xDst;
pts[0].y = yDst;
pts[1].x = xDst + widthDst;
pts[1].y = yDst + heightDst;
LPtoDP(physDevDst->hdc, pts, 2);
xDst = pts[0].x;
yDst = pts[0].y;
widthDst = pts[1].x - pts[0].x;
heightDst = pts[1].y - pts[0].y;
TRACE(" vportdst=%d,%d-%d,%d wnddst=%d,%d-%d,%d\n",
dcDst->vportOrgX, dcDst->vportOrgY,
......@@ -1262,10 +1266,16 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT
if (useSrc)
{
xSrc = XLPTODP( dcSrc, xSrc );
ySrc = YLPTODP( dcSrc, ySrc );
widthSrc = widthSrc * dcSrc->vportExtX / dcSrc->wndExtX;
heightSrc = heightSrc * dcSrc->vportExtY / dcSrc->wndExtY;
pts[0].x = xSrc;
pts[0].y = ySrc;
pts[1].x = xSrc + widthSrc;
pts[1].y = ySrc + heightSrc;
LPtoDP(physDevSrc->hdc, pts, 2);
xSrc = pts[0].x;
ySrc = pts[0].y;
widthSrc = pts[1].x - pts[0].x;
heightSrc = pts[1].y - pts[0].y;
fStretch = (widthSrc != widthDst) || (heightSrc != heightDst);
TRACE(" vportsrc=%d,%d-%d,%d wndsrc=%d,%d-%d,%d\n",
dcSrc->vportOrgX, dcSrc->vportOrgY,
......@@ -1553,13 +1563,26 @@ BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) &&
(dcSrc->bitsPerPixel == dcDst->bitsPerPixel))
{
POINT pts[2];
/* do everything ourselves; map coordinates */
xSrc = XLPTODP( dcSrc, xSrc );
ySrc = YLPTODP( dcSrc, ySrc );
xDst = XLPTODP( dcDst, xDst );
yDst = YLPTODP( dcDst, yDst );
width = MulDiv(width, dcDst->vportExtX, dcDst->wndExtX);
height = MulDiv(height, dcDst->vportExtY, dcDst->wndExtY);
pts[0].x = xSrc;
pts[0].y = ySrc;
pts[1].x = xSrc + width;
pts[1].y = ySrc + height;
LPtoDP(physDevSrc->hdc, pts, 2);
width = pts[1].x - pts[0].x;
height = pts[1].y - pts[0].y;
xSrc = pts[0].x;
ySrc = pts[0].y;
pts[0].x = xDst;
pts[0].y = yDst;
LPtoDP(physDevDst->hdc, pts, 1);
xDst = pts[0].x;
yDst = pts[0].y;
/* Perform basic clipping */
if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, width, height,
......
......@@ -4737,6 +4737,7 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
DWORD width, oldcy = cy;
INT result;
int height, tmpheight;
POINT pt;
DC *dc = physDev->dc;
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
......@@ -4753,6 +4754,10 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
if (xSrc + cx >= width) cx = width - xSrc;
if (!cx || !cy) return 0;
pt.x = xDest;
pt.y = yDest;
LPtoDP(physDev->hdc, &pt, 1);
X11DRV_SetupGCForText( physDev ); /* To have the correct colors */
TSXSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[dc->ROPmode-1]);
......@@ -4796,9 +4801,8 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
descr.xSrc = xSrc;
descr.ySrc = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy)
: ySrc - startscan;
descr.xDest = physDev->org.x + XLPTODP( dc, xDest );
descr.yDest = physDev->org.y + YLPTODP( dc, yDest ) +
(tmpheight >= 0 ? oldcy-cy : 0);
descr.xDest = physDev->org.x + pt.x;
descr.yDest = physDev->org.y + pt.y + (tmpheight >= 0 ? oldcy-cy : 0);
descr.width = cx;
descr.height = cy;
descr.useShm = FALSE;
......
......@@ -58,6 +58,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
XChar2b *str2b = NULL;
BOOL dibUpdateFlag = FALSE;
BOOL result = TRUE;
POINT pt;
DC *dc = physDev->dc;
if(dc->gdiFont)
......@@ -105,24 +106,26 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
return FALSE;
if (!X11DRV_GetTextExtentPoint( physDev, wstr, count, &sz ))
return FALSE;
rect.left = INTERNAL_XWPTODP( dc, x, y );
rect.right = INTERNAL_XWPTODP( dc, x+sz.cx, y+sz.cy );
rect.top = INTERNAL_YWPTODP( dc, x, y );
rect.bottom = INTERNAL_YWPTODP( dc, x+sz.cx, y+sz.cy );
rect.left = x;
rect.right = x + sz.cx;
rect.top = y;
rect.bottom = y + sz.cy;
}
else
{
rect.left = INTERNAL_XWPTODP( dc, lprect->left, lprect->top );
rect.right = INTERNAL_XWPTODP( dc, lprect->right, lprect->bottom );
rect.top = INTERNAL_YWPTODP( dc, lprect->left, lprect->top );
rect.bottom = INTERNAL_YWPTODP( dc, lprect->right, lprect->bottom );
rect = *lprect;
}
LPtoDP(physDev->hdc, (POINT*)&rect, 2);
if (rect.right < rect.left) SWAP_INT( rect.left, rect.right );
if (rect.bottom < rect.top) SWAP_INT( rect.top, rect.bottom );
}
x = INTERNAL_XWPTODP( dc, x, y );
y = INTERNAL_YWPTODP( dc, x, y );
pt.x = x;
pt.y = y;
LPtoDP(physDev->hdc, &pt, 1);
x = pt.x;
y = pt.y;
TRACE("\treal coord: x=%i, y=%i, rect=(%d,%d - %d,%d)\n",
x, y, rect.left, rect.top, rect.right, rect.bottom);
......@@ -168,16 +171,22 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{
case TA_LEFT:
if (dc->textAlign & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP( dc, x + xwidth, y - ywidth );
dc->CursPosY = INTERNAL_YDPTOWP( dc, x + xwidth, y - ywidth );
pt.x = x + xwidth;
pt.y = y - ywidth;
DPtoLP(physDev->hdc, &pt, 1);
dc->CursPosX = pt.x;
dc->CursPosY = pt.y;
}
break;
case TA_RIGHT:
x -= xwidth;
y += ywidth;
if (dc->textAlign & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP( dc, x, y );
dc->CursPosY = INTERNAL_YDPTOWP( dc, x, y );
pt.x = x;
pt.y = y;
DPtoLP(physDev->hdc, &pt, 1);
dc->CursPosX = pt.x;
dc->CursPosY = pt.y;
}
break;
case TA_CENTER:
......
......@@ -290,14 +290,6 @@ typedef struct tagDC_FUNCS
#define METAFILE_MEMORY 1
#define METAFILE_DISK 2
/* Device <-> logical coords conversion */
/* A floating point version of the POINT structure */
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.
......@@ -307,163 +299,6 @@ static inline INT WINE_UNUSED GDI_ROUND(FLOAT val)
return (int)floor(val + 0.5);
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in floating point format). Returns TRUE if successful, else FALSE.
*/
static inline BOOL WINE_UNUSED INTERNAL_DPTOLP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
/* Check that the viewport-to-world transformation is valid */
if (!dc->vport2WorldValid)
return FALSE;
/* Perform the transformation */
x = point->x;
y = point->y;
point->x = x * dc->xformVport2World.eM11 +
y * dc->xformVport2World.eM21 +
dc->xformVport2World.eDx;
point->y = x * dc->xformVport2World.eM12 +
y * dc->xformVport2World.eM22 +
dc->xformVport2World.eDy;
return TRUE;
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in integer format). Returns TRUE if successful, else FALSE.
*/
static inline BOOL WINE_UNUSED 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 floating point format).
*/
static inline void WINE_UNUSED INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
{
FLOAT x, y;
/* Perform the transformation */
x = point->x;
y = point->y;
point->x = x * dc->xformWorld2Vport.eM11 +
y * dc->xformWorld2Vport.eM21 +
dc->xformWorld2Vport.eDx;
point->y = x * dc->xformWorld2Vport.eM12 +
y * dc->xformWorld2Vport.eM22 +
dc->xformWorld2Vport.eDy;
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in integer format).
*/
static inline void WINE_UNUSED 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);
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in integer format).
*/
static inline INT WINE_UNUSED INTERNAL_XWPTODP(DC *dc, INT x, INT y)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)x;
floatPoint.y=(FLOAT)y;
INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
/* Round to integers */
return GDI_ROUND(floatPoint.x);
}
/* Performs a world-to-viewport transformation on the specified point (which
* is in integer format).
*/
static inline INT WINE_UNUSED INTERNAL_YWPTODP(DC *dc, INT x, INT y)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)x;
floatPoint.y=(FLOAT)y;
INTERNAL_LPTODP_FLOAT(dc, &floatPoint);
/* Round to integers */
return GDI_ROUND(floatPoint.y);
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in integer format).
*/
static inline INT WINE_UNUSED INTERNAL_XDPTOWP(DC *dc, INT x, INT y)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)x;
floatPoint.y=(FLOAT)y;
INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
/* Round to integers */
return GDI_ROUND(floatPoint.x);
}
/* Performs a viewport-to-world transformation on the specified point (which
* is in integer format).
*/
static inline INT WINE_UNUSED INTERNAL_YDPTOWP(DC *dc, INT x, INT y)
{
FLOAT_POINT floatPoint;
/* Perform operation with floating point */
floatPoint.x=(FLOAT)x;
floatPoint.y=(FLOAT)y;
INTERNAL_DPTOLP_FLOAT(dc, &floatPoint);
/* Round to integers */
return 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)
/* World -> Device size conversion */
/* Performs a world-to-viewport transformation on the specified width (which
......
......@@ -228,12 +228,14 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
else
{
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
if (!(newRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR;
RECT rect;
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
LPtoDP( hdc, (POINT*)&rect, 2 );
if (!(newRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR;
else
{
if (!dc->hClipRgn)
......@@ -271,27 +273,30 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top,
DC *dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
TRACE("%04x %d,%d - %d,%d\n", hdc, left, top, right, bottom );
if(dc->funcs->pIntersectClipRect)
ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
else
{
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
RECT rect;
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
LPtoDP( hdc, (POINT*)&rect, 2 );
if (!dc->hClipRgn)
{
dc->hClipRgn = CreateRectRgn( left, top, right, bottom );
dc->hClipRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom );
ret = SIMPLEREGION;
}
else
{
HRGN newRgn;
if (!(newRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR;
if (!(newRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom))) ret = ERROR;
else
{
ret = CombineRgn( dc->hClipRgn, dc->hClipRgn, newRgn, RGN_AND );
......@@ -313,17 +318,19 @@ INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top,
{
HRGN tempRgn;
INT16 ret;
RECT rect;
DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
LPtoDP( hdc, (POINT*)&rect, 2 );
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
TRACE("%04x %d,%d - %d,%d\n", hdc, rect.left, rect.top, rect.right, rect.bottom );
if (!(tempRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR;
if (!(tempRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR;
else
{
ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_DIFF );
......@@ -343,17 +350,19 @@ INT16 WINAPI IntersectVisRect16( HDC16 hdc, INT16 left, INT16 top,
{
HRGN tempRgn;
INT16 ret;
RECT rect;
DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
rect.left = left;
rect.top = top;
rect.right = right;
rect.bottom = bottom;
LPtoDP( hdc, (POINT*)&rect, 2 );
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
TRACE("%04x %d,%d - %d,%d\n", hdc, rect.left, rect.top, rect.right, rect.bottom );
if (!(tempRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR;
if (!(tempRgn = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom ))) ret = ERROR;
else
{
ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_AND );
......@@ -386,7 +395,12 @@ BOOL WINAPI PtVisible( HDC hdc, INT x, INT y )
if (!dc) return FALSE;
if (dc->hGCClipRgn)
{
ret = PtInRegion( dc->hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) );
POINT pt;
pt.x = x;
pt.y = y;
LPtoDP( hdc, &pt, 1 );
ret = PtInRegion( dc->hGCClipRgn, pt.x, pt.y );
}
GDI_ReleaseObj( hdc );
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment