gdi32: Use an internal version of LPtoDP that takes a DC * where possible.

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-18 11:32:56 +01:00 committed by Alexandre Julliard
parent af5014f4c8
commit f4bc213ce5
7 changed files with 34 additions and 20 deletions

View File

@ -112,7 +112,7 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
rect.top = dst->log_y; rect.top = dst->log_y;
rect.right = dst->log_x + dst->log_width; rect.right = dst->log_x + dst->log_width;
rect.bottom = dst->log_y + dst->log_height; rect.bottom = dst->log_y + dst->log_height;
LPtoDP( dc_dst->hSelf, (POINT *)&rect, 2 ); lp_to_dp( dc_dst, (POINT *)&rect, 2 );
dst->x = rect.left; dst->x = rect.left;
dst->y = rect.top; dst->y = rect.top;
dst->width = rect.right - rect.left; dst->width = rect.right - rect.left;
@ -134,7 +134,7 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
rect.top = src->log_y; rect.top = src->log_y;
rect.right = src->log_x + src->log_width; rect.right = src->log_x + src->log_width;
rect.bottom = src->log_y + src->log_height; rect.bottom = src->log_y + src->log_height;
LPtoDP( dc_src->hSelf, (POINT *)&rect, 2 ); lp_to_dp( dc_src, (POINT *)&rect, 2 );
src->x = rect.left; src->x = rect.left;
src->y = rect.top; src->y = rect.top;
src->width = rect.right - rect.left; src->width = rect.right - rect.left;
@ -420,7 +420,7 @@ BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
pts[i].x = vert_array[i].x; pts[i].x = vert_array[i].x;
pts[i].y = vert_array[i].y; pts[i].y = vert_array[i].y;
} }
LPtoDP( dev->hdc, pts, nvert ); lp_to_dp( dc, pts, nvert );
/* compute bounding rect of all the rectangles/triangles */ /* compute bounding rect of all the rectangles/triangles */
reset_bounds( &dst.visrect ); reset_bounds( &dst.visrect );
@ -496,7 +496,7 @@ COLORREF nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
src.visrect.left = x; src.visrect.left = x;
src.visrect.top = y; src.visrect.top = y;
LPtoDP( dev->hdc, (POINT *)&src.visrect, 1 ); lp_to_dp( dc, (POINT *)&src.visrect, 1 );
src.visrect.right = src.visrect.left + 1; src.visrect.right = src.visrect.left + 1;
src.visrect.bottom = src.visrect.top + 1; src.visrect.bottom = src.visrect.top + 1;
src.x = src.visrect.left; src.x = src.visrect.left;

View File

@ -50,7 +50,7 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot
rect.top = top; rect.top = top;
rect.right = right; rect.right = right;
rect.bottom = bottom; rect.bottom = bottom;
LPtoDP( dc->hSelf, (POINT *)&rect, 2 ); lp_to_dp( dc, (POINT *)&rect, 2 );
if (dc->layout & LAYOUT_RTL) if (dc->layout & LAYOUT_RTL)
{ {
int tmp = rect.left; int tmp = rect.left;
@ -375,7 +375,7 @@ BOOL WINAPI PtVisible( HDC hdc, INT x, INT y )
pt.x = x; pt.x = x;
pt.y = y; pt.y = y;
LPtoDP( hdc, &pt, 1 ); lp_to_dp( dc, &pt, 1 );
update_dc( dc ); update_dc( dc );
ret = (!get_dc_device_rect( dc, &visrect ) || ret = (!get_dc_device_rect( dc, &visrect ) ||
(pt.x >= visrect.left && pt.x < visrect.right && (pt.x >= visrect.left && pt.x < visrect.right &&
@ -398,7 +398,7 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
TRACE("%p %s\n", hdc, wine_dbgstr_rect( rect )); TRACE("%p %s\n", hdc, wine_dbgstr_rect( rect ));
tmpRect = *rect; tmpRect = *rect;
LPtoDP( hdc, (POINT *)&tmpRect, 2 ); lp_to_dp( dc, (POINT *)&tmpRect, 2 );
order_rect( &tmpRect ); order_rect( &tmpRect );
update_dc( dc ); update_dc( dc );

View File

@ -1535,7 +1535,7 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
{ {
RECT rc = *rect; RECT rc = *rect;
LPtoDP( hdc, (POINT *)&rc, 2 ); lp_to_dp( dc, (POINT *)&rc, 2 );
add_bounds_rect( &dc->bounds, &rc ); add_bounds_rect( &dc->bounds, &rc );
} }

View File

@ -490,7 +490,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
rect.top = yDst; rect.top = yDst;
rect.right = xDst + widthDst; rect.right = xDst + widthDst;
rect.bottom = yDst + heightDst; rect.bottom = yDst + heightDst;
LPtoDP( dc->hSelf, (POINT *)&rect, 2 ); lp_to_dp( dc, (POINT *)&rect, 2 );
dst.x = rect.left; dst.x = rect.left;
dst.y = rect.top; dst.y = rect.top;
dst.width = rect.right - rect.left; dst.width = rect.right - rect.left;
@ -848,7 +848,7 @@ INT nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx, DWOR
pt.x = x_dst; pt.x = x_dst;
pt.y = y_dst; pt.y = y_dst;
LPtoDP( dev->hdc, &pt, 1 ); lp_to_dp( dc, &pt, 1 );
dst.x = pt.x; dst.x = pt.x;
dst.y = pt.y; dst.y = pt.y;
dst.width = cx; dst.width = cx;

View File

@ -87,7 +87,7 @@ static inline INT INTERNAL_YWSTODS(DC *dc, INT height)
pt[0].x = pt[0].y = 0; pt[0].x = pt[0].y = 0;
pt[1].x = 0; pt[1].x = 0;
pt[1].y = height; pt[1].y = height;
LPtoDP(dc->hSelf, pt, 2); lp_to_dp(dc, pt, 2);
return pt[1].y - pt[0].y; return pt[1].y - pt[0].y;
} }
@ -2258,7 +2258,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
if (lprect && (flags & (ETO_OPAQUE | ETO_CLIPPED))) if (lprect && (flags & (ETO_OPAQUE | ETO_CLIPPED)))
{ {
rc = *lprect; rc = *lprect;
LPtoDP(hdc, (POINT*)&rc, 2); lp_to_dp(dc, (POINT*)&rc, 2);
order_rect( &rc ); order_rect( &rc );
if (flags & ETO_OPAQUE) if (flags & ETO_OPAQUE)
physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL ); physdev->funcs->pExtTextOut( physdev, 0, 0, ETO_OPAQUE, &rc, NULL, 0, NULL );
@ -2273,7 +2273,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
pt.x = x; pt.x = x;
pt.y = y; pt.y = y;
LPtoDP(hdc, &pt, 1); lp_to_dp(dc, &pt, 1);
x = pt.x; x = pt.x;
y = pt.y; y = pt.y;
@ -2335,7 +2335,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
desired[1].x = cosEsc * total.x + sinEsc * total.y; desired[1].x = cosEsc * total.x + sinEsc * total.y;
desired[1].y = -sinEsc * total.x + cosEsc * total.y; desired[1].y = -sinEsc * total.x + cosEsc * total.y;
LPtoDP(hdc, desired, 2); lp_to_dp(dc, desired, 2);
desired[1].x -= desired[0].x; desired[1].x -= desired[0].x;
desired[1].y -= desired[0].y; desired[1].y -= desired[0].y;
@ -2365,7 +2365,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
desired[0].x = desired[0].y = 0; desired[0].x = desired[0].y = 0;
desired[1].x = sz.cx; desired[1].x = sz.cx;
desired[1].y = 0; desired[1].y = 0;
LPtoDP(hdc, desired, 2); lp_to_dp(dc, desired, 2);
desired[1].x -= desired[0].x; desired[1].x -= desired[0].x;
desired[1].y -= desired[0].y; desired[1].y -= desired[0].y;

View File

@ -309,6 +309,9 @@ extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN; extern void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
extern void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN; extern void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
/* mapping.c */
extern void lp_to_dp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
/* metafile.c */ /* metafile.c */
extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN; extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN; extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN;

View File

@ -350,13 +350,12 @@ BOOL WINAPI DPtoLP( HDC hdc, LPPOINT points, INT count )
/*********************************************************************** /***********************************************************************
* LPtoDP (GDI32.@) * lp_to_dp
*
* Internal version of LPtoDP that takes a DC *.
*/ */
BOOL WINAPI LPtoDP( HDC hdc, LPPOINT points, INT count ) void lp_to_dp( DC *dc, POINT *points, INT count )
{ {
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
while (count--) while (count--)
{ {
double x = points->x; double x = points->x;
@ -369,6 +368,18 @@ BOOL WINAPI LPtoDP( HDC hdc, LPPOINT points, INT count )
dc->xformWorld2Vport.eDy + 0.5 ); dc->xformWorld2Vport.eDy + 0.5 );
points++; points++;
} }
}
/***********************************************************************
* LPtoDP (GDI32.@)
*/
BOOL WINAPI LPtoDP( HDC hdc, POINT *points, INT count )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
lp_to_dp( dc, points, count );
release_dc_ptr( dc ); release_dc_ptr( dc );
return TRUE; return TRUE;
} }