Huw Davies : gdi32: Use an internal version of LPtoDP that takes a DC * where possible.
Alexandre Julliard
julliard at winehq.org
Mon Jul 18 09:22:34 CDT 2016
Module: wine
Branch: master
Commit: f4bc213ce5aa6b814d110deafbc17fc193e245a4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f4bc213ce5aa6b814d110deafbc17fc193e245a4
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Jul 18 11:32:56 2016 +0100
gdi32: Use an internal version of LPtoDP that takes a DC * where possible.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/bitblt.c | 8 ++++----
dlls/gdi32/clipping.c | 6 +++---
dlls/gdi32/dc.c | 2 +-
dlls/gdi32/dib.c | 4 ++--
dlls/gdi32/font.c | 10 +++++-----
dlls/gdi32/gdi_private.h | 3 +++
dlls/gdi32/mapping.c | 21 ++++++++++++++++-----
7 files changed, 34 insertions(+), 20 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index ed011fc..7e9a096 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -112,7 +112,7 @@ static BOOL get_vis_rectangles( DC *dc_dst, struct bitblt_coords *dst,
rect.top = dst->log_y;
rect.right = dst->log_x + dst->log_width;
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->y = rect.top;
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.right = src->log_x + src->log_width;
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->y = rect.top;
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].y = vert_array[i].y;
}
- LPtoDP( dev->hdc, pts, nvert );
+ lp_to_dp( dc, pts, nvert );
/* compute bounding rect of all the rectangles/triangles */
reset_bounds( &dst.visrect );
@@ -496,7 +496,7 @@ COLORREF nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
src.visrect.left = x;
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.bottom = src.visrect.top + 1;
src.x = src.visrect.left;
diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c
index ccd61d0..0dc7896 100644
--- a/dlls/gdi32/clipping.c
+++ b/dlls/gdi32/clipping.c
@@ -50,7 +50,7 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot
rect.top = top;
rect.right = right;
rect.bottom = bottom;
- LPtoDP( dc->hSelf, (POINT *)&rect, 2 );
+ lp_to_dp( dc, (POINT *)&rect, 2 );
if (dc->layout & LAYOUT_RTL)
{
int tmp = rect.left;
@@ -375,7 +375,7 @@ BOOL WINAPI PtVisible( HDC hdc, INT x, INT y )
pt.x = x;
pt.y = y;
- LPtoDP( hdc, &pt, 1 );
+ lp_to_dp( dc, &pt, 1 );
update_dc( dc );
ret = (!get_dc_device_rect( dc, &visrect ) ||
(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 ));
tmpRect = *rect;
- LPtoDP( hdc, (POINT *)&tmpRect, 2 );
+ lp_to_dp( dc, (POINT *)&tmpRect, 2 );
order_rect( &tmpRect );
update_dc( dc );
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 2e54671..01572b8 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -1535,7 +1535,7 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
{
RECT rc = *rect;
- LPtoDP( hdc, (POINT *)&rc, 2 );
+ lp_to_dp( dc, (POINT *)&rc, 2 );
add_bounds_rect( &dc->bounds, &rc );
}
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index fbeeb5b..9a1414e 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -490,7 +490,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
rect.top = yDst;
rect.right = xDst + widthDst;
rect.bottom = yDst + heightDst;
- LPtoDP( dc->hSelf, (POINT *)&rect, 2 );
+ lp_to_dp( dc, (POINT *)&rect, 2 );
dst.x = rect.left;
dst.y = rect.top;
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.y = y_dst;
- LPtoDP( dev->hdc, &pt, 1 );
+ lp_to_dp( dc, &pt, 1 );
dst.x = pt.x;
dst.y = pt.y;
dst.width = cx;
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index fade4df..700b5e2 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -87,7 +87,7 @@ static inline INT INTERNAL_YWSTODS(DC *dc, INT height)
pt[0].x = pt[0].y = 0;
pt[1].x = 0;
pt[1].y = height;
- LPtoDP(dc->hSelf, pt, 2);
+ lp_to_dp(dc, pt, 2);
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)))
{
rc = *lprect;
- LPtoDP(hdc, (POINT*)&rc, 2);
+ lp_to_dp(dc, (POINT*)&rc, 2);
order_rect( &rc );
if (flags & ETO_OPAQUE)
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.y = y;
- LPtoDP(hdc, &pt, 1);
+ lp_to_dp(dc, &pt, 1);
x = pt.x;
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].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].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[1].x = sz.cx;
desired[1].y = 0;
- LPtoDP(hdc, desired, 2);
+ lp_to_dp(dc, desired, 2);
desired[1].x -= desired[0].x;
desired[1].y -= desired[0].y;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index cbe66a8..5524c2e 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -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_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 */
extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN;
extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index 665042a..5a1941b 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -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--)
{
double x = points->x;
@@ -369,6 +368,18 @@ BOOL WINAPI LPtoDP( HDC hdc, LPPOINT points, INT count )
dc->xformWorld2Vport.eDy + 0.5 );
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 );
return TRUE;
}
More information about the wine-cvs
mailing list