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