2003-05-18 17:16:18 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-05-18 17:16:18 +00:00
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$ */
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2004-05-10 17:07:20 +00:00
|
|
|
#include <w32k.h>
|
1999-07-23 19:57:18 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2009-06-01 23:24:20 +00:00
|
|
|
static
|
2000-02-20 22:52:50 +00:00
|
|
|
INT
|
2009-06-01 23:24:20 +00:00
|
|
|
FASTCALL
|
|
|
|
IntGetipfdDevMax(PDC pdc)
|
1999-07-23 19:57:18 +00:00
|
|
|
{
|
2009-06-01 23:24:20 +00:00
|
|
|
INT Ret = 0;
|
|
|
|
PPDEVOBJ ppdev = pdc->ppdev;
|
|
|
|
|
|
|
|
if (ppdev->flFlags & PDEV_META_DEVICE)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ppdev->DriverFunctions.DescribePixelFormat)
|
|
|
|
{
|
|
|
|
Ret = ppdev->DriverFunctions.DescribePixelFormat(
|
2009-08-16 12:57:41 +00:00
|
|
|
ppdev->dhpdev,
|
2009-06-01 23:24:20 +00:00
|
|
|
1,
|
|
|
|
0,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Ret) pdc->ipfdDevMax = Ret;
|
|
|
|
|
|
|
|
return Ret;
|
1999-07-23 19:57:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
INT
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiDescribePixelFormat(HDC hDC,
|
1999-07-23 19:57:18 +00:00
|
|
|
INT PixelFormat,
|
|
|
|
UINT BufSize,
|
|
|
|
LPPIXELFORMATDESCRIPTOR pfd)
|
|
|
|
{
|
2009-06-01 23:24:20 +00:00
|
|
|
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(
|
2009-08-16 12:57:41 +00:00
|
|
|
ppdev->dhpdev,
|
2009-06-01 23:24:20 +00:00
|
|
|
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;
|
1999-07-23 19:57:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2005-12-28 20:31:44 +00:00
|
|
|
APIENTRY
|
|
|
|
NtGdiSetPixelFormat(
|
|
|
|
IN HDC hdc,
|
|
|
|
IN INT ipfd)
|
1999-07-23 19:57:18 +00:00
|
|
|
{
|
2009-06-02 06:50:36 +00:00
|
|
|
PDC pdc;
|
|
|
|
PPDEVOBJ ppdev;
|
|
|
|
HWND hWnd;
|
|
|
|
PWNDOBJ pWndObj;
|
|
|
|
SURFOBJ *pso = NULL;
|
|
|
|
BOOL Ret = FALSE;
|
|
|
|
|
|
|
|
pdc = DC_LockDc(hdc);
|
|
|
|
if (!pdc)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pdc->ipfdDevMax) IntGetipfdDevMax(pdc);
|
|
|
|
|
|
|
|
if ( ipfd < 1 ||
|
|
|
|
ipfd > pdc->ipfdDevMax )
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
UserEnterExclusive();
|
|
|
|
hWnd = UserGethWnd(hdc, &pWndObj);
|
|
|
|
UserLeave();
|
|
|
|
|
|
|
|
if (!hWnd)
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_WINDOW_STYLE);
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
ppdev = pdc->ppdev;
|
|
|
|
|
2009-06-04 01:33:43 +00:00
|
|
|
/*
|
|
|
|
WndObj is needed so exit on NULL pointer.
|
|
|
|
*/
|
2009-06-02 06:50:36 +00:00
|
|
|
if (pWndObj) pso = pWndObj->psoOwner;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT);
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ppdev->flFlags & PDEV_META_DEVICE)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ppdev->DriverFunctions.SetPixelFormat)
|
|
|
|
{
|
|
|
|
Ret = ppdev->DriverFunctions.SetPixelFormat(
|
|
|
|
pso,
|
|
|
|
ipfd,
|
|
|
|
hWnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
DC_UnlockDc(pdc);
|
|
|
|
return Ret;
|
1999-07-23 19:57:18 +00:00
|
|
|
}
|
|
|
|
|
2000-02-20 22:52:50 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-08-19 11:48:50 +00:00
|
|
|
NtGdiSwapBuffers(HDC hDC)
|
1999-07-23 19:57:18 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
2004-07-14 20:48:58 +00:00
|
|
|
return FALSE;
|
1999-07-23 19:57:18 +00:00
|
|
|
}
|
|
|
|
|
2003-05-18 17:16:18 +00:00
|
|
|
/* EOF */
|