diff --git a/reactos/dll/win32/gdi32/gdi32.def b/reactos/dll/win32/gdi32/gdi32.def index a7049d0db09..2f897b5fdb3 100644 --- a/reactos/dll/win32/gdi32/gdi32.def +++ b/reactos/dll/win32/gdi32/gdi32.def @@ -89,7 +89,7 @@ CreateRoundRectRgn@24=NtGdiCreateRoundRectRgn@24 CreateScalableFontResourceA@16 CreateScalableFontResourceW@16 CreateSolidBrush@4 -DPtoLP@12=NtGdiDPtoLP@12 +DPtoLP@12 DeleteColorSpace@4 DeleteDC@4=NtGdiDeleteObjectApp@4 DeleteEnhMetaFile@4 @@ -464,7 +464,7 @@ HT_Get8BPPFormatPalette@16 HT_Get8BPPMaskPalette@24 IntersectClipRect@20=NtGdiIntersectClipRect@20 InvertRgn@8=NtGdiInvertRgn@8 -LPtoDP@12=NtGdiLPtoDP@12 +LPtoDP@12 LineDDA@24 LineTo@12=NtGdiLineTo@12 MaskBlt@48 diff --git a/reactos/dll/win32/gdi32/objects/coord.c b/reactos/dll/win32/gdi32/objects/coord.c index 28100a52845..fbd62dfec3c 100644 --- a/reactos/dll/win32/gdi32/objects/coord.c +++ b/reactos/dll/win32/gdi32/objects/coord.c @@ -103,7 +103,7 @@ DPtoLP ( HDC hDC, LPPOINT Points, INT Count ) PAGE_EXTENTS_CHANGED | // do processing in kernel space. WORLD_XFORM_CHANGED ) #endif - return NtGdiTransformPoints( hDC, Points, Points, Count, 0); // Last is 0 or 2 + return NtGdiTransformPoints( hDC, Points, Points, Count, GdiDpToLp); // DPtoLP mode. #if 0 else { @@ -129,7 +129,7 @@ LPtoDP ( HDC hDC, LPPOINT Points, INT Count ) PAGE_EXTENTS_CHANGED | WORLD_XFORM_CHANGED ) #endif - return NtGdiTransformPoints( hDC, Points, Points, Count, 0); + return NtGdiTransformPoints( hDC, Points, Points, Count, GdiLpToDp); // LPtoDP mode #if 0 else { diff --git a/reactos/include/reactos/win32k/ntgdibad.h b/reactos/include/reactos/win32k/ntgdibad.h index 5d46908d119..386510aa4f6 100644 --- a/reactos/include/reactos/win32k/ntgdibad.h +++ b/reactos/include/reactos/win32k/ntgdibad.h @@ -184,15 +184,6 @@ NtGdiCreatePolyPolygonRgn(CONST PPOINT pt, INT Count, INT PolyFillMode); -/* Use NtGdiTransformPoints with GdiDpToLp. */ -BOOL -STDCALL -NtGdiDPtoLP ( - HDC hDC, - LPPOINT Points, - int Count - ); - /* Meta are user-mode. */ BOOL STDCALL @@ -495,15 +486,6 @@ NtGdiGetWorldTransform ( LPXFORM Xform ); -/* Use NtGdiTransformPoints with GdiDpToLp */ -BOOL -STDCALL -NtGdiLPtoDP ( - HDC hDC, - LPPOINT Points, - int Count - ); - /* Needs to be done in user-mode. */ BOOL STDCALL diff --git a/reactos/subsystems/win32/win32k/objects/coord.c b/reactos/subsystems/win32/win32k/objects/coord.c index 4fa0c450caa..244ae8c15e5 100644 --- a/reactos/subsystems/win32/win32k/objects/coord.c +++ b/reactos/subsystems/win32/win32k/objects/coord.c @@ -157,99 +157,6 @@ IntDPtoLP ( PDC dc, LPPOINT Points, INT Count ) CoordDPtoLP ( dc, &Points[i] ); } -/*! - * Converts points from device coordinates into logical coordinates. Conversion depends on the mapping mode, - * world transfrom, viewport origin settings for the given device context. - * \param hDC device context. - * \param Points an array of POINT structures (in/out). - * \param Count number of elements in the array of POINT structures. - * \return TRUE if success. -*/ -BOOL STDCALL -NtGdiDPtoLP(HDC hDC, - LPPOINT UnsafePoints, - int Count) -{ - PDC dc; - NTSTATUS Status = STATUS_SUCCESS; - LPPOINT Points; - ULONG Size; - - dc = DC_LockDc(hDC); - if (!dc) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - - if (!UnsafePoints || Count <= 0) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return FALSE; - } - - Size = Count * sizeof(POINT); - - Points = (LPPOINT)ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD); - if(!Points) - { - DC_UnlockDc(dc); - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - _SEH_TRY - { - ProbeForWrite(UnsafePoints, - Size, - 1); - RtlCopyMemory(Points, - UnsafePoints, - Size); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - DC_UnlockDc(dc); - ExFreePool(Points); - SetLastNtError(Status); - return FALSE; - } - - IntDPtoLP(dc, Points, Count); - - _SEH_TRY - { - /* pointer was already probed! */ - RtlCopyMemory(UnsafePoints, - Points, - Size); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(!NT_SUCCESS(Status)) - { - DC_UnlockDc(dc); - ExFreePool(Points); - SetLastNtError(Status); - return FALSE; - } - - DC_UnlockDc(dc); - ExFreePool(Points); - return TRUE; -} - int FASTCALL IntGetGraphicsMode ( PDC dc ) @@ -390,8 +297,13 @@ IntLPtoDP ( PDC dc, LPPOINT Points, INT Count ) * \param Count number of elements in the array of POINT structures. * \return TRUE if success. */ -BOOL STDCALL -NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count ) +BOOL +APIENTRY +NtGdiTransformPoints( HDC hDC, + PPOINT UnsafePtsIn, + PPOINT UnsafePtOut, + INT Count, + INT iMode ) { PDC dc; NTSTATUS Status = STATUS_SUCCESS; @@ -405,7 +317,7 @@ NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count ) return FALSE; } - if (!UnsafePoints || Count <= 0) + if (!UnsafePtsIn || !UnsafePtOut || Count <= 0) { DC_UnlockDc(dc); SetLastWin32Error(ERROR_INVALID_PARAMETER); @@ -424,11 +336,14 @@ NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count ) _SEH_TRY { - ProbeForWrite(UnsafePoints, + ProbeForWrite(UnsafePtOut, + Size, + 1); + ProbeForRead(UnsafePtsIn, Size, 1); RtlCopyMemory(Points, - UnsafePoints, + UnsafePtsIn, Size); } _SEH_HANDLE @@ -445,12 +360,28 @@ NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count ) return FALSE; } - IntLPtoDP(dc, Points, Count); + switch (iMode) + { + case GdiDpToLp: + IntDPtoLP(dc, Points, Count); + break; + case GdiLpToDp: + IntLPtoDP(dc, Points, Count); + break; + case 2: // Not supported yet. Need testing. + default: + { + DC_UnlockDc(dc); + ExFreePool(Points); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + } _SEH_TRY { /* pointer was already probed! */ - RtlCopyMemory(UnsafePoints, + RtlCopyMemory(UnsafePtOut, Points, Size); } @@ -473,19 +404,6 @@ NtGdiLPtoDP ( HDC hDC, LPPOINT UnsafePoints, INT Count ) return TRUE; } - -BOOL -APIENTRY -NtGdiTransformPoints( HDC hdc, - PPOINT UnsafePtsIn, - PPOINT UnsafePtOut, - INT Count, - INT iMode ) -{ - UNIMPLEMENTED; - return FALSE; -} - BOOL STDCALL NtGdiModifyWorldTransform(HDC hDC, diff --git a/reactos/subsystems/win32/win32k/w32ksvc.db b/reactos/subsystems/win32/win32k/w32ksvc.db index b3db603f33b..5ca144211a3 100644 --- a/reactos/subsystems/win32/win32k/w32ksvc.db +++ b/reactos/subsystems/win32/win32k/w32ksvc.db @@ -770,7 +770,6 @@ NtGdiCreatePalette 1 NtGdiCreatePolygonRgn 3 NtGdiCreatePolyPolygonRgn 4 NtGdiCreateScalableFontResource 4 -NtGdiDPtoLP 3 NtGdiDeleteEnhMetaFile 1 NtGdiDeleteObject 1 NtGdiEnumEnhMetaFile 5 @@ -816,7 +815,6 @@ NtGdiGetTextAlign 1 NtGdiGetTextColor 1 NtGdiGetTextExtentPoint32 4 NtGdiGetWorldTransform 2 -NtGdiLPtoDP 3 NtGdiMoveToEx 4 NtGdiOffsetViewportOrgEx 4 NtGdiOffsetWindowOrgEx 4