gdi32: Use POINT and SIZE to hold positions and extents.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-07-27 09:59:25 +01:00 committed by Alexandre Julliard
parent 82ca87bc2d
commit 6a8cfea99b
9 changed files with 159 additions and 186 deletions

View File

@ -394,12 +394,10 @@ BOOL WINAPI SetBrushOrgEx( HDC hdc, INT x, INT y, LPPOINT oldorg )
if (!dc) return FALSE;
if (oldorg)
{
oldorg->x = dc->brushOrgX;
oldorg->y = dc->brushOrgY;
}
dc->brushOrgX = x;
dc->brushOrgY = y;
*oldorg = dc->brush_org;
dc->brush_org.x = x;
dc->brush_org.y = y;
release_dc_ptr( dc );
return TRUE;
}

View File

@ -233,8 +233,8 @@ INT nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
if (dc->hClipRgn)
{
x = MulDiv( x, dc->vportExtX, dc->wndExtX );
y = MulDiv( y, dc->vportExtY, dc->wndExtY );
x = MulDiv( x, dc->vport_ext.cx, dc->wnd_ext.cx );
y = MulDiv( y, dc->vport_ext.cy, dc->wnd_ext.cy );
if (dc->layout & LAYOUT_RTL) x = -x;
ret = OffsetRgn( dc->hClipRgn, x, y );
update_dc_clipping( dc );

View File

@ -76,14 +76,14 @@ static inline DC *get_dc_obj( HDC hdc )
*/
static void set_initial_dc_state( DC *dc )
{
dc->wndOrgX = 0;
dc->wndOrgY = 0;
dc->wndExtX = 1;
dc->wndExtY = 1;
dc->vportOrgX = 0;
dc->vportOrgY = 0;
dc->vportExtX = 1;
dc->vportExtY = 1;
dc->wnd_org.x = 0;
dc->wnd_org.y = 0;
dc->wnd_ext.cx = 1;
dc->wnd_ext.cy = 1;
dc->vport_org.x = 0;
dc->vport_org.y = 0;
dc->vport_ext.cx = 1;
dc->vport_ext.cy = 1;
dc->miterLimit = 10.0f; /* 10.0 is the default, from MSDN */
dc->layout = 0;
dc->font_code_page = CP_ACP;
@ -96,8 +96,8 @@ static void set_initial_dc_state( DC *dc )
dc->dcBrushColor = RGB( 255, 255, 255 );
dc->dcPenColor = RGB( 0, 0, 0 );
dc->textColor = RGB( 0, 0, 0 );
dc->brushOrgX = 0;
dc->brushOrgY = 0;
dc->brush_org.x = 0;
dc->brush_org.y = 0;
dc->mapperFlags = 0;
dc->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP;
dc->charExtra = 0;
@ -105,8 +105,8 @@ static void set_initial_dc_state( DC *dc )
dc->breakRem = 0;
dc->MapMode = MM_TEXT;
dc->GraphicsMode = GM_COMPATIBLE;
dc->CursPosX = 0;
dc->CursPosY = 0;
dc->cur_pos.x = 0;
dc->cur_pos.y = 0;
dc->ArcDirection = AD_COUNTERCLOCKWISE;
dc->xformWorld2Wnd.eM11 = 1.0f;
dc->xformWorld2Wnd.eM12 = 0.0f;
@ -311,16 +311,16 @@ static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
static void construct_window_to_viewport(DC *dc, XFORM *xform)
{
double scaleX, scaleY;
scaleX = (double)dc->vportExtX / (double)dc->wndExtX;
scaleY = (double)dc->vportExtY / (double)dc->wndExtY;
scaleX = (double)dc->vport_ext.cx / (double)dc->wnd_ext.cx;
scaleY = (double)dc->vport_ext.cy / (double)dc->wnd_ext.cy;
if (dc->layout & LAYOUT_RTL) scaleX = -scaleX;
xform->eM11 = scaleX;
xform->eM12 = 0.0;
xform->eM21 = 0.0;
xform->eM22 = scaleY;
xform->eDx = (double)dc->vportOrgX - scaleX * (double)dc->wndOrgX;
xform->eDy = (double)dc->vportOrgY - scaleY * (double)dc->wndOrgY;
xform->eDx = (double)dc->vport_org.x - scaleX * (double)dc->wnd_org.x;
xform->eDy = (double)dc->vport_org.y - scaleY * (double)dc->wnd_org.y;
if (dc->layout & LAYOUT_RTL) xform->eDx = dc->vis_rect.right - dc->vis_rect.left - 1 - xform->eDx;
}
@ -383,8 +383,7 @@ INT nulldrv_SaveDC( PHYSDEV dev )
newdc->textColor = dc->textColor;
newdc->dcBrushColor = dc->dcBrushColor;
newdc->dcPenColor = dc->dcPenColor;
newdc->brushOrgX = dc->brushOrgX;
newdc->brushOrgY = dc->brushOrgY;
newdc->brush_org = dc->brush_org;
newdc->mapperFlags = dc->mapperFlags;
newdc->textAlign = dc->textAlign;
newdc->charExtra = dc->charExtra;
@ -392,21 +391,16 @@ INT nulldrv_SaveDC( PHYSDEV dev )
newdc->breakRem = dc->breakRem;
newdc->MapMode = dc->MapMode;
newdc->GraphicsMode = dc->GraphicsMode;
newdc->CursPosX = dc->CursPosX;
newdc->CursPosY = dc->CursPosY;
newdc->cur_pos = dc->cur_pos;
newdc->ArcDirection = dc->ArcDirection;
newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
newdc->xformWorld2Vport = dc->xformWorld2Vport;
newdc->xformVport2World = dc->xformVport2World;
newdc->vport2WorldValid = dc->vport2WorldValid;
newdc->wndOrgX = dc->wndOrgX;
newdc->wndOrgY = dc->wndOrgY;
newdc->wndExtX = dc->wndExtX;
newdc->wndExtY = dc->wndExtY;
newdc->vportOrgX = dc->vportOrgX;
newdc->vportOrgY = dc->vportOrgY;
newdc->vportExtX = dc->vportExtX;
newdc->vportExtY = dc->vportExtY;
newdc->wnd_org = dc->wnd_org;
newdc->wnd_ext = dc->wnd_ext;
newdc->vport_org = dc->vport_org;
newdc->vport_ext = dc->vport_ext;
newdc->virtual_res = dc->virtual_res;
newdc->virtual_size = dc->virtual_size;
@ -466,8 +460,7 @@ BOOL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->textColor = dcs->textColor;
dc->dcBrushColor = dcs->dcBrushColor;
dc->dcPenColor = dcs->dcPenColor;
dc->brushOrgX = dcs->brushOrgX;
dc->brushOrgY = dcs->brushOrgY;
dc->brush_org = dcs->brush_org;
dc->mapperFlags = dcs->mapperFlags;
dc->textAlign = dcs->textAlign;
dc->charExtra = dcs->charExtra;
@ -475,21 +468,16 @@ BOOL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->breakRem = dcs->breakRem;
dc->MapMode = dcs->MapMode;
dc->GraphicsMode = dcs->GraphicsMode;
dc->CursPosX = dcs->CursPosX;
dc->CursPosY = dcs->CursPosY;
dc->cur_pos = dcs->cur_pos;
dc->ArcDirection = dcs->ArcDirection;
dc->xformWorld2Wnd = dcs->xformWorld2Wnd;
dc->xformWorld2Vport = dcs->xformWorld2Vport;
dc->xformVport2World = dcs->xformVport2World;
dc->vport2WorldValid = dcs->vport2WorldValid;
dc->wndOrgX = dcs->wndOrgX;
dc->wndOrgY = dcs->wndOrgY;
dc->wndExtX = dcs->wndExtX;
dc->wndExtY = dcs->wndExtY;
dc->vportOrgX = dcs->vportOrgX;
dc->vportOrgY = dcs->vportOrgY;
dc->vportExtX = dcs->vportExtX;
dc->vportExtY = dcs->vportExtY;
dc->wnd_org = dcs->wnd_org;
dc->wnd_ext = dcs->wnd_ext;
dc->vport_org = dcs->vport_org;
dc->vport_ext = dcs->vport_ext;
dc->virtual_res = dcs->virtual_res;
dc->virtual_size = dcs->virtual_size;
@ -1792,8 +1780,7 @@ BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
pt->x = dc->brushOrgX;
pt->y = dc->brushOrgY;
*pt = dc->brush_org;
release_dc_ptr( dc );
return TRUE;
}
@ -1806,8 +1793,7 @@ BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
pt->x = dc->CursPosX;
pt->y = dc->CursPosY;
*pt = dc->cur_pos;
release_dc_ptr( dc );
return TRUE;
}
@ -1820,8 +1806,7 @@ BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
size->cx = dc->vportExtX;
size->cy = dc->vportExtY;
*size = dc->vport_ext;
release_dc_ptr( dc );
return TRUE;
}
@ -1834,8 +1819,7 @@ BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
pt->x = dc->vportOrgX;
pt->y = dc->vportOrgY;
*pt = dc->vport_org;
release_dc_ptr( dc );
return TRUE;
}
@ -1848,8 +1832,7 @@ BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
size->cx = dc->wndExtX;
size->cy = dc->wndExtY;
*size = dc->wnd_ext;
release_dc_ptr( dc );
return TRUE;
}
@ -1862,8 +1845,7 @@ BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
pt->x = dc->wndOrgX;
pt->y = dc->wndOrgY;
*pt = dc->wnd_org;
release_dc_ptr( dc );
return TRUE;
}

View File

@ -1029,7 +1029,7 @@ BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
ret = physdev->funcs->pSetTextJustification( physdev, extra, breaks );
if (ret)
{
extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
extra = abs((extra * dc->vport_ext.cx + dc->wnd_ext.cx / 2) / dc->wnd_ext.cx);
if (!extra) breaks = 0;
if (breaks)
{

View File

@ -72,14 +72,10 @@ typedef struct tagDC
BOOL bounds_enabled:1; /* bounds tracking is enabled */
BOOL path_open:1; /* path is currently open (only for saved DCs) */
INT wndOrgX; /* Window origin */
INT wndOrgY;
INT wndExtX; /* Window extent */
INT wndExtY;
INT vportOrgX; /* Viewport origin */
INT vportOrgY;
INT vportExtX; /* Viewport extent */
INT vportExtY;
POINT wnd_org; /* Window origin */
SIZE wnd_ext; /* Window extent */
POINT vport_org; /* Viewport origin */
SIZE vport_ext; /* Viewport extent */
SIZE virtual_res; /* Initially HORZRES,VERTRES. Changed by SetVirtualResolution */
SIZE virtual_size; /* Initially HORZSIZE,VERTSIZE. Changed by SetVirtualResolution */
RECT vis_rect; /* visible rectangle in screen coords */
@ -112,8 +108,7 @@ typedef struct tagDC
COLORREF textColor;
COLORREF dcBrushColor;
COLORREF dcPenColor;
short brushOrgX;
short brushOrgY;
POINT brush_org;
DWORD mapperFlags; /* Font mapper flags */
WORD textAlign; /* Text alignment from SetTextAlign() */
@ -123,8 +118,7 @@ typedef struct tagDC
INT MapMode;
INT GraphicsMode; /* Graphics mode */
ABORTPROC pAbortProc; /* AbortProc for Printing */
INT CursPosX; /* Current position */
INT CursPosY;
POINT cur_pos; /* Current position */
INT ArcDirection;
XFORM xformWorld2Wnd; /* World-to-window transformation */
XFORM xformWorld2Vport; /* World-to-viewport transformation */

View File

@ -62,20 +62,20 @@ static void MAPPING_FixIsotropic( DC * dc )
{
SIZE virtual_size = get_dc_virtual_size( dc );
SIZE virtual_res = get_dc_virtual_res( dc );
double xdim = fabs((double)dc->vportExtX * virtual_size.cx / (virtual_res.cx * dc->wndExtX));
double ydim = fabs((double)dc->vportExtY * virtual_size.cy / (virtual_res.cy * dc->wndExtY));
double xdim = fabs((double)dc->vport_ext.cx * virtual_size.cx / (virtual_res.cx * dc->wnd_ext.cx));
double ydim = fabs((double)dc->vport_ext.cy * virtual_size.cy / (virtual_res.cy * dc->wnd_ext.cy));
if (xdim > ydim)
{
INT mincx = (dc->vportExtX >= 0) ? 1 : -1;
dc->vportExtX = floor(dc->vportExtX * ydim / xdim + 0.5);
if (!dc->vportExtX) dc->vportExtX = mincx;
INT mincx = (dc->vport_ext.cx >= 0) ? 1 : -1;
dc->vport_ext.cx = floor(dc->vport_ext.cx * ydim / xdim + 0.5);
if (!dc->vport_ext.cx) dc->vport_ext.cx = mincx;
}
else
{
INT mincy = (dc->vportExtY >= 0) ? 1 : -1;
dc->vportExtY = floor(dc->vportExtY * xdim / ydim + 0.5);
if (!dc->vportExtY) dc->vportExtY = mincy;
INT mincy = (dc->vport_ext.cy >= 0) ? 1 : -1;
dc->vport_ext.cy = floor(dc->vport_ext.cy * xdim / ydim + 0.5);
if (!dc->vport_ext.cy) dc->vport_ext.cy = mincy;
}
}
@ -89,12 +89,10 @@ BOOL nulldrv_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
DC *dc = get_nulldrv_dc( dev );
if (pt)
{
pt->x = dc->vportOrgX;
pt->y = dc->vportOrgY;
}
dc->vportOrgX += x;
dc->vportOrgY += y;
*pt = dc->vport_org;
dc->vport_org.x += x;
dc->vport_org.y += y;
DC_UpdateXforms( dc );
return TRUE;
}
@ -104,12 +102,10 @@ BOOL nulldrv_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
DC *dc = get_nulldrv_dc( dev );
if (pt)
{
pt->x = dc->wndOrgX;
pt->y = dc->wndOrgY;
}
dc->wndOrgX += x;
dc->wndOrgY += y;
*pt = dc->wnd_org;
dc->wnd_org.x += x;
dc->wnd_org.y += y;
DC_UpdateXforms( dc );
return TRUE;
}
@ -119,17 +115,15 @@ BOOL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num,
DC *dc = get_nulldrv_dc( dev );
if (size)
{
size->cx = dc->vportExtX;
size->cy = dc->vportExtY;
}
*size = dc->vport_ext;
if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
if (!x_num || !x_denom || !y_num || !y_denom) return FALSE;
dc->vportExtX = (dc->vportExtX * x_num) / x_denom;
dc->vportExtY = (dc->vportExtY * y_num) / y_denom;
if (dc->vportExtX == 0) dc->vportExtX = 1;
if (dc->vportExtY == 0) dc->vportExtY = 1;
dc->vport_ext.cx = (dc->vport_ext.cx * x_num) / x_denom;
dc->vport_ext.cy = (dc->vport_ext.cy * y_num) / y_denom;
if (dc->vport_ext.cx == 0) dc->vport_ext.cx = 1;
if (dc->vport_ext.cy == 0) dc->vport_ext.cy = 1;
if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
@ -140,17 +134,15 @@ BOOL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, I
DC *dc = get_nulldrv_dc( dev );
if (size)
{
size->cx = dc->wndExtX;
size->cy = dc->wndExtY;
}
*size = dc->wnd_ext;
if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
if (!x_num || !x_denom || !y_num || !y_denom) return FALSE;
dc->wndExtX = (dc->wndExtX * x_num) / x_denom;
dc->wndExtY = (dc->wndExtY * y_num) / y_denom;
if (dc->wndExtX == 0) dc->wndExtX = 1;
if (dc->wndExtY == 0) dc->wndExtY = 1;
dc->wnd_ext.cx = (dc->wnd_ext.cx * x_num) / x_denom;
dc->wnd_ext.cy = (dc->wnd_ext.cy * y_num) / y_denom;
if (dc->wnd_ext.cx == 0) dc->wnd_ext.cx = 1;
if (dc->wnd_ext.cy == 0) dc->wnd_ext.cy = 1;
if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
@ -169,41 +161,41 @@ INT nulldrv_SetMapMode( PHYSDEV dev, INT mode )
switch (mode)
{
case MM_TEXT:
dc->wndExtX = 1;
dc->wndExtY = 1;
dc->vportExtX = 1;
dc->vportExtY = 1;
dc->wnd_ext.cx = 1;
dc->wnd_ext.cy = 1;
dc->vport_ext.cx = 1;
dc->vport_ext.cy = 1;
break;
case MM_LOMETRIC:
case MM_ISOTROPIC:
dc->wndExtX = virtual_size.cx * 10;
dc->wndExtY = virtual_size.cy * 10;
dc->vportExtX = virtual_res.cx;
dc->vportExtY = -virtual_res.cy;
dc->wnd_ext.cx = virtual_size.cx * 10;
dc->wnd_ext.cy = virtual_size.cy * 10;
dc->vport_ext.cx = virtual_res.cx;
dc->vport_ext.cy = -virtual_res.cy;
break;
case MM_HIMETRIC:
dc->wndExtX = virtual_size.cx * 100;
dc->wndExtY = virtual_size.cy * 100;
dc->vportExtX = virtual_res.cx;
dc->vportExtY = -virtual_res.cy;
dc->wnd_ext.cx = virtual_size.cx * 100;
dc->wnd_ext.cy = virtual_size.cy * 100;
dc->vport_ext.cx = virtual_res.cx;
dc->vport_ext.cy = -virtual_res.cy;
break;
case MM_LOENGLISH:
dc->wndExtX = MulDiv(1000, virtual_size.cx, 254);
dc->wndExtY = MulDiv(1000, virtual_size.cy, 254);
dc->vportExtX = virtual_res.cx;
dc->vportExtY = -virtual_res.cy;
dc->wnd_ext.cx = MulDiv(1000, virtual_size.cx, 254);
dc->wnd_ext.cy = MulDiv(1000, virtual_size.cy, 254);
dc->vport_ext.cx = virtual_res.cx;
dc->vport_ext.cy = -virtual_res.cy;
break;
case MM_HIENGLISH:
dc->wndExtX = MulDiv(10000, virtual_size.cx, 254);
dc->wndExtY = MulDiv(10000, virtual_size.cy, 254);
dc->vportExtX = virtual_res.cx;
dc->vportExtY = -virtual_res.cy;
dc->wnd_ext.cx = MulDiv(10000, virtual_size.cx, 254);
dc->wnd_ext.cy = MulDiv(10000, virtual_size.cy, 254);
dc->vport_ext.cx = virtual_res.cx;
dc->vport_ext.cy = -virtual_res.cy;
break;
case MM_TWIPS:
dc->wndExtX = MulDiv(14400, virtual_size.cx, 254);
dc->wndExtY = MulDiv(14400, virtual_size.cy, 254);
dc->vportExtX = virtual_res.cx;
dc->vportExtY = -virtual_res.cy;
dc->wnd_ext.cx = MulDiv(14400, virtual_size.cx, 254);
dc->wnd_ext.cy = MulDiv(14400, virtual_size.cy, 254);
dc->vport_ext.cx = virtual_res.cx;
dc->vport_ext.cy = -virtual_res.cy;
break;
case MM_ANISOTROPIC:
break;
@ -221,14 +213,12 @@ BOOL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
DC *dc = get_nulldrv_dc( dev );
if (size)
{
size->cx = dc->vportExtX;
size->cy = dc->vportExtY;
}
*size = dc->vport_ext;
if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->vportExtX = cx;
dc->vportExtY = cy;
dc->vport_ext.cx = cx;
dc->vport_ext.cy = cy;
if (dc->MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
@ -239,12 +229,10 @@ BOOL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
DC *dc = get_nulldrv_dc( dev );
if (pt)
{
pt->x = dc->vportOrgX;
pt->y = dc->vportOrgY;
}
dc->vportOrgX = x;
dc->vportOrgY = y;
*pt = dc->vport_org;
dc->vport_org.x = x;
dc->vport_org.y = y;
DC_UpdateXforms( dc );
return TRUE;
}
@ -254,14 +242,12 @@ BOOL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
DC *dc = get_nulldrv_dc( dev );
if (size)
{
size->cx = dc->wndExtX;
size->cy = dc->wndExtY;
}
*size = dc->wnd_ext;
if (dc->MapMode != MM_ISOTROPIC && dc->MapMode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->wndExtX = cx;
dc->wndExtY = cy;
dc->wnd_ext.cx = cx;
dc->wnd_ext.cy = cy;
/* The API docs say that you should call SetWindowExtEx before
SetViewportExtEx. This advice does not imply that Windows
doesn't ensure the isotropic mapping after SetWindowExtEx! */
@ -275,12 +261,10 @@ BOOL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
DC *dc = get_nulldrv_dc( dev );
if (pt)
{
pt->x = dc->wndOrgX;
pt->y = dc->wndOrgY;
}
dc->wndOrgX = x;
dc->wndOrgY = y;
*pt = dc->wnd_org;
dc->wnd_org.x = x;
dc->wnd_org.y = y;
DC_UpdateXforms( dc );
return TRUE;
}

View File

@ -240,9 +240,10 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
physdev = GET_DC_PHYSDEV( dc, pLineTo );
ret = physdev->funcs->pLineTo( physdev, x, y );
if(ret) {
dc->CursPosX = x;
dc->CursPosY = y;
if(ret)
{
dc->cur_pos.x = x;
dc->cur_pos.y = y;
}
release_dc_ptr( dc );
return ret;
@ -260,12 +261,11 @@ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt )
if(!dc) return FALSE;
if(pt) {
pt->x = dc->CursPosX;
pt->y = dc->CursPosY;
}
dc->CursPosX = x;
dc->CursPosY = y;
if(pt)
*pt = dc->cur_pos;
dc->cur_pos.x = x;
dc->cur_pos.y = y;
physdev = GET_DC_PHYSDEV( dc, pMoveTo );
ret = physdev->funcs->pMoveTo( physdev, x, y );
@ -318,11 +318,12 @@ BOOL WINAPI ArcTo( HDC hdc,
physdev = GET_DC_PHYSDEV( dc, pArcTo );
result = physdev->funcs->pArcTo( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
if (result) {
if (result)
{
angle = atan2(((yend-ycenter)/height),
((xend-xcenter)/width));
dc->CursPosX = GDI_ROUND(xcenter+(cos(angle)*xradius));
dc->CursPosY = GDI_ROUND(ycenter+(sin(angle)*yradius));
dc->cur_pos.x = GDI_ROUND( xcenter + (cos( angle ) * xradius) );
dc->cur_pos.y = GDI_ROUND( ycenter + (sin( angle ) * yradius) );
}
release_dc_ptr( dc );
return result;
@ -627,10 +628,8 @@ BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
ret = physdev->funcs->pPolylineTo( physdev, pt, cCount );
if (ret && cCount)
{
dc->CursPosX = pt[cCount-1].x;
dc->CursPosY = pt[cCount-1].y;
}
dc->cur_pos = pt[cCount - 1];
release_dc_ptr( dc );
return ret;
}
@ -779,10 +778,9 @@ BOOL WINAPI PolyBezierTo( HDC hdc, const POINT* lppt, DWORD cPoints )
physdev = GET_DC_PHYSDEV( dc, pPolyBezierTo );
ret = physdev->funcs->pPolyBezierTo( physdev, lppt, cPoints );
if(ret) {
dc->CursPosX = lppt[cPoints-1].x;
dc->CursPosY = lppt[cPoints-1].y;
}
if(ret)
dc->cur_pos = lppt[cPoints - 1];
release_dc_ptr( dc );
return ret;
}
@ -806,9 +804,10 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F
physdev = GET_DC_PHYSDEV( dc, pAngleArc );
result = physdev->funcs->pAngleArc( physdev, x, y, dwRadius, eStartAngle, eSweepAngle );
if (result) {
dc->CursPosX = GDI_ROUND( x + cos((eStartAngle+eSweepAngle)*M_PI/180) * dwRadius );
dc->CursPosY = GDI_ROUND( y - sin((eStartAngle+eSweepAngle)*M_PI/180) * dwRadius );
if (result)
{
dc->cur_pos.x = GDI_ROUND( x + cos( (eStartAngle + eSweepAngle) * M_PI / 180 ) * dwRadius );
dc->cur_pos.y = GDI_ROUND( y - sin( (eStartAngle + eSweepAngle) * M_PI / 180 ) * dwRadius );
}
release_dc_ptr( dc );
return result;
@ -830,10 +829,8 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
physdev = GET_DC_PHYSDEV( dc, pPolyDraw );
result = physdev->funcs->pPolyDraw( physdev, lppt, lpbTypes, cCount );
if (result && cCount)
{
dc->CursPosX = lppt[cCount - 1].x;
dc->CursPosY = lppt[cCount - 1].y;
}
dc->cur_pos = lppt[cCount - 1];
release_dc_ptr( dc );
return result;
}

View File

@ -2016,8 +2016,7 @@ BOOL nulldrv_BeginPath( PHYSDEV dev )
}
physdev = get_path_physdev( find_dc_driver( dc, &path_driver ));
physdev->path = path;
path->pos.x = dc->CursPosX;
path->pos.y = dc->CursPosY;
path->pos = dc->cur_pos;
LPtoDP( dev->hdc, &path->pos, 1 );
if (dc->path) free_gdi_path( dc->path );
dc->path = NULL;

View File

@ -23,6 +23,7 @@
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/test.h"
@ -343,10 +344,28 @@ static void test_palette_brush(void)
DeleteObject( palette2 );
}
static void test_brush_org( void )
{
HDC hdc = GetDC( 0 );
POINT old, pt;
SetBrushOrgEx( hdc, 0, 0, &old );
SetBrushOrgEx( hdc, 1, 1, &pt );
ok( pt.x == 0 && pt.y == 0, "got %d,%d\n", pt.x, pt.y );
SetBrushOrgEx( hdc, 0x10000, -1, &pt );
ok( pt.x == 1 && pt.y == 1, "got %d,%d\n", pt.x, pt.y );
SetBrushOrgEx( hdc, old.x, old.y, &pt );
ok( pt.x == 0x10000 && pt.y == -1, "got %d,%d\n", pt.x, pt.y );
ReleaseDC( 0, hdc );
}
START_TEST(brush)
{
test_solidbrush();
test_hatch_brush();
test_pattern_brush();
test_palette_brush();
test_brush_org();
}