Module: wine Branch: master Commit: 250237e1c1d1e7a16678de7ba8107c0431807971 URL: http://source.winehq.org/git/wine.git/?a=commit;h=250237e1c1d1e7a16678de7ba8...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Nov 17 12:19:36 2009 +0100
gdi32: Reimplement LPtoDP16/DPtoLP16 on top of the 32-bit functions.
---
dlls/gdi32/gdi16.c | 56 +++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c index 62c9ac6..c8d0536 100644 --- a/dlls/gdi32/gdi16.c +++ b/dlls/gdi32/gdi16.c @@ -3564,17 +3564,29 @@ VOID WINAPI SetMagicColors16(HDC16 hDC, COLORREF color, UINT16 index) */ BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count ) { - DC * dc = get_dc_ptr( HDC_32(hdc) ); - if (!dc) return FALSE; + POINT points32[8], *pt32 = points32; + int i; + BOOL ret;
- while (count--) + if (count > 8) { - 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++; + if (!(pt32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pt32) ))) return FALSE; } - release_dc_ptr( dc ); - return TRUE; + for (i = 0; i < count; i++) + { + pt32[i].x = points[i].x; + pt32[i].y = points[i].y; + } + if ((ret = DPtoLP( HDC_32(hdc), pt32, count ))) + { + for (i = 0; i < count; i++) + { + points[i].x = pt32[i].x; + points[i].y = pt32[i].y; + } + } + if (pt32 != points32) HeapFree( GetProcessHeap(), 0, pt32 ); + return ret; }
@@ -3583,17 +3595,29 @@ BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count ) */ BOOL16 WINAPI LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count ) { - DC * dc = get_dc_ptr( HDC_32(hdc) ); - if (!dc) return FALSE; + POINT points32[8], *pt32 = points32; + int i; + BOOL ret;
- while (count--) + if (count > 8) { - 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++; + if (!(pt32 = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*pt32) ))) return FALSE; } - release_dc_ptr( dc ); - return TRUE; + for (i = 0; i < count; i++) + { + pt32[i].x = points[i].x; + pt32[i].y = points[i].y; + } + if ((ret = LPtoDP( HDC_32(hdc), pt32, count ))) + { + for (i = 0; i < count; i++) + { + points[i].x = pt32[i].x; + points[i].y = pt32[i].y; + } + } + if (pt32 != points32) HeapFree( GetProcessHeap(), 0, pt32 ); + return ret; }