mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 16:36:11 +00:00
- Implement NtGdiDescribePixelFormat, needs testing.
svn path=/trunk/; revision=41245
This commit is contained in:
parent
e2bc37faee
commit
5e49d1b3cc
|
@ -23,15 +23,34 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
static
|
||||
INT
|
||||
APIENTRY
|
||||
NtGdiChoosePixelFormat(HDC hDC,
|
||||
CONST PPIXELFORMATDESCRIPTOR pfd)
|
||||
FASTCALL
|
||||
IntGetipfdDevMax(PDC pdc)
|
||||
{
|
||||
INT Ret = 0;
|
||||
PPDEVOBJ ppdev = pdc->ppdev;
|
||||
|
||||
if (ppdev->flFlags & PDEV_META_DEVICE)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ppdev->DriverFunctions.DescribePixelFormat)
|
||||
{
|
||||
|
||||
Ret = ppdev->DriverFunctions.DescribePixelFormat(
|
||||
ppdev->hPDev,
|
||||
1,
|
||||
0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (Ret) pdc->ipfdDevMax = Ret;
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
APIENTRY
|
||||
|
@ -40,10 +59,69 @@ NtGdiDescribePixelFormat(HDC hDC,
|
|||
UINT BufSize,
|
||||
LPPIXELFORMATDESCRIPTOR pfd)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
PDC pdc;
|
||||
PPDEVOBJ ppdev;
|
||||
INT Ret = 0;
|
||||
PIXELFORMATDESCRIPTOR pfdSafe;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
if (!BufSize) return 0;
|
||||
|
||||
pdc = DC_LockDc(hDC);
|
||||
if (!pdc)
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pdc->ipfdDevMax) IntGetipfdDevMax(pdc);
|
||||
|
||||
if ( BufSize < sizeof(PIXELFORMATDESCRIPTOR) ||
|
||||
PixelFormat < 1 ||
|
||||
PixelFormat > pdc->ipfdDevMax )
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
ppdev = pdc->ppdev;
|
||||
|
||||
if (ppdev->flFlags & PDEV_META_DEVICE)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
if (ppdev->DriverFunctions.DescribePixelFormat)
|
||||
{
|
||||
|
||||
Ret = ppdev->DriverFunctions.DescribePixelFormat(
|
||||
ppdev->hPDev,
|
||||
PixelFormat,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
&pfdSafe);
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForWrite( pfd,
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
1);
|
||||
RtlCopyMemory(&pfdSafe, pfd, sizeof(PIXELFORMATDESCRIPTOR));
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
Status = _SEH2_GetExceptionCode();
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
if (!NT_SUCCESS(Status)) SetLastNtError(Status);
|
||||
|
||||
Exit:
|
||||
DC_UnlockDc(pdc);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
BOOL
|
||||
APIENTRY
|
||||
|
|
Loading…
Reference in a new issue