Author: tkreuzer Date: Wed Aug 1 09:17:55 2012 New Revision: 57013
URL: http://svn.reactos.org/svn/reactos?rev=57013&view=rev Log: [WIN32K] - Use trivial Clip object, if NULL one is passed in IntEngAlphaBlend - In NtGdiDescribePixelFormat allow passing NULL for the output pixel descriptor and copy the result *to* the caller not from the caller. - Fix some format strings - Update some annotations
Modified: trunk/reactos/win32ss/gdi/eng/alphablend.c trunk/reactos/win32ss/gdi/eng/pdevobj.c trunk/reactos/win32ss/gdi/ntgdi/arc.c trunk/reactos/win32ss/gdi/ntgdi/dcutil.c trunk/reactos/win32ss/gdi/ntgdi/wingl.c trunk/reactos/win32ss/user/ntuser/class.h
Modified: trunk/reactos/win32ss/gdi/eng/alphablend.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/alphablend.... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/alphablend.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/alphablend.c [iso-8859-1] Wed Aug 1 09:17:55 2012 @@ -141,7 +141,7 @@ Rect.top = InputRect.top + (CombinedRect.top - OutputRect.top) * (InputRect.bottom - InputRect.top) / (OutputRect.bottom - OutputRect.top); Rect.bottom = InputRect.bottom + (CombinedRect.bottom - OutputRect.bottom) * (InputRect.bottom - InputRect.top) / (OutputRect.bottom - OutputRect.top); ASSERT(InputRect.left < InputRect.right && InputRect.top < InputRect.bottom); - + /* Aplha blend one rect */ Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend( OutputObj, InputObj, &CombinedRect, &Rect, ClipRegion, ColorTranslation, BlendObj); @@ -170,7 +170,7 @@ Rect.top = InputRect.top + (CombinedRect.top - OutputRect.top) * (InputRect.bottom - InputRect.top) / (OutputRect.bottom - OutputRect.top); Rect.bottom = InputRect.bottom + (CombinedRect.bottom - OutputRect.bottom) * (InputRect.bottom - InputRect.top) / (OutputRect.bottom - OutputRect.top); ASSERT(InputRect.left < InputRect.right && InputRect.top < InputRect.bottom); - + /* Alpha blend one rect */ Ret = DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_AlphaBlend( OutputObj, InputObj, &CombinedRect, &Rect, ClipRegion, ColorTranslation, BlendObj) && Ret; @@ -192,49 +192,51 @@ return Ret; }
-BOOL APIENTRY -IntEngAlphaBlend(IN SURFOBJ *psoDest, - IN SURFOBJ *psoSource, - IN CLIPOBJ *ClipRegion, - IN XLATEOBJ *ColorTranslation, - IN PRECTL DestRect, - IN PRECTL SourceRect, - IN BLENDOBJ *BlendObj) +BOOL +APIENTRY +IntEngAlphaBlend( + _Inout_ SURFOBJ *psoDest, + _In_ SURFOBJ *psoSource, + _In_opt_ CLIPOBJ *pco, + _In_opt_ XLATEOBJ *pxlo, + _In_ RECTL *prclDest, + _In_ RECTL *prclSrc, + _In_ BLENDOBJ *pBlendObj) { BOOL ret = FALSE; SURFACE *psurfDest; - //SURFACE *psurfSource;
ASSERT(psoDest); - psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); - ASSERT(psoSource); - //psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj); - - ASSERT(DestRect); - ASSERT(SourceRect); + ASSERT(prclDest); + ASSERT(prclSrc); + //ASSERT(pBlendObj); + + /* If no clip object is given, use trivial one */ + if (!pco) pco = &gxcoTrivial.ClipObj;
/* Check if there is anything to draw */ - if (ClipRegion != NULL && - (ClipRegion->rclBounds.left >= ClipRegion->rclBounds.right || - ClipRegion->rclBounds.top >= ClipRegion->rclBounds.bottom)) + if ((pco->rclBounds.left >= pco->rclBounds.right) || + (pco->rclBounds.top >= pco->rclBounds.bottom)) { /* Nothing to do */ return TRUE; }
+ psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj); + /* Call the driver's DrvAlphaBlend if available */ if (psurfDest->flags & HOOK_ALPHABLEND) { ret = GDIDEVFUNCS(psoDest).AlphaBlend( - psoDest, psoSource, ClipRegion, ColorTranslation, - DestRect, SourceRect, BlendObj); - } - - if (! ret) - { - ret = EngAlphaBlend(psoDest, psoSource, ClipRegion, ColorTranslation, - DestRect, SourceRect, BlendObj); + psoDest, psoSource, pco, pxlo, + prclDest, prclSrc, pBlendObj); + } + + if (!ret) + { + ret = EngAlphaBlend(psoDest, psoSource, pco, pxlo, + prclDest, prclSrc, pBlendObj); }
return ret;
Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/pdevobj.c?r... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] Wed Aug 1 09:17:55 2012 @@ -291,14 +291,14 @@ { /* ... use the device's default one */ pdm = pGraphicsDevice->pDevModeList[pGraphicsDevice->iDefaultMode].pdm; - DPRINT("Using iDefaultMode = %ld\n", pGraphicsDevice->iDefaultMode); + DPRINT("Using iDefaultMode = %lu\n", pGraphicsDevice->iDefaultMode); }
/* Try to get a diplay driver */ ppdev->pldev = EngLoadImageEx(pdm->dmDeviceName, LDEV_DEVICE_DISPLAY); if (!ppdev->pldev) { - DPRINT1("Could not load display driver '%ls', '%s'\n", + DPRINT1("Could not load display driver '%ls', '%ls'\n", pGraphicsDevice->pDiplayDrivers, pdm->dmDeviceName); ExFreePoolWithTag(ppdev, GDITAG_PDEV); @@ -617,18 +617,13 @@ EngGetDriverName(IN HDEV hdev) { PPDEVOBJ ppdev = (PPDEVOBJ)hdev; - PLDEVOBJ pldev; - - if (!hdev) - return NULL; - - pldev = ppdev->pldev; - ASSERT(pldev); - - if (!pldev->pGdiDriverInfo) - return NULL; - - return pldev->pGdiDriverInfo->DriverName.Buffer; + + ASSERT(ppdev); + ASSERT(ppdev->pldev); + ASSERT(ppdev->pldev->pGdiDriverInfo); + ASSERT(ppdev->pldev->pGdiDriverInfo->DriverName.Buffer); + + return ppdev->pldev->pGdiDriverInfo->DriverName.Buffer; }
Modified: trunk/reactos/win32ss/gdi/ntgdi/arc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/arc.c?rev... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/arc.c [iso-8859-1] Wed Aug 1 09:17:55 2012 @@ -57,12 +57,17 @@ { INT tmp = Bottom; Bottom = Top; Top = tmp; } - if ((Left == Right) || - (Top == Bottom) || - (((arctype != GdiTypeArc) || (arctype != GdiTypeArcTo)) && - ((Right - Left == 1) || - (Bottom - Top == 1)))) - return TRUE; + + /* Check if the target rect is empty */ + if ((Left == Right) || (Top == Bottom)) return TRUE; + + // FIXME: this needs to be verified + if ((arctype == GdiTypeChord ) || (arctype == GdiTypePie)) + { + if ((Right - Left == 1) || (Bottom - Top == 1)) + return TRUE; + } +
pdcattr = dc->pdcattr;
Modified: trunk/reactos/win32ss/gdi/ntgdi/dcutil.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcutil.c?... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dcutil.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dcutil.c [iso-8859-1] Wed Aug 1 09:17:55 2012 @@ -332,13 +332,13 @@ return Ret; }
-BOOL +BOOL _Success_(return != FALSE) APIENTRY NtGdiGetAndSetDCDword( - HDC hDC, - UINT u, - DWORD dwIn, - DWORD *Result) + _In_ HDC hdc, + _In_ UINT u, + _In_ DWORD dwIn, + _Out_ DWORD *pdwResult) { BOOL Ret = TRUE; PDC pdc; @@ -347,13 +347,13 @@ DWORD SafeResult = 0; NTSTATUS Status = STATUS_SUCCESS;
- if (!Result) + if (!pdwResult) { EngSetLastError(ERROR_INVALID_PARAMETER); return FALSE; }
- pdc = DC_LockDc(hDC); + pdc = DC_LockDc(hdc); if (!pdc) { EngSetLastError(ERROR_INVALID_HANDLE); @@ -442,8 +442,8 @@ { _SEH2_TRY { - ProbeForWrite(Result, sizeof(DWORD), 1); - *Result = SafeResult; + ProbeForWrite(pdwResult, sizeof(DWORD), 1); + *pdwResult = SafeResult; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
Modified: trunk/reactos/win32ss/gdi/ntgdi/wingl.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/wingl.c?r... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/wingl.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/wingl.c [iso-8859-1] Wed Aug 1 09:17:55 2012 @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: subsystems/win32/win32k/objects/wingl.c * PURPOSE: WinGL API - * PROGRAMMER: + * PROGRAMMER: */
#include <win32k.h> @@ -38,23 +38,23 @@ return Ret; }
- + _Success_(return != 0) INT APIENTRY -NtGdiDescribePixelFormat(HDC hDC, - INT PixelFormat, - UINT BufSize, - LPPIXELFORMATDESCRIPTOR pfd) +NtGdiDescribePixelFormat( + _In_ HDC hdc, + _In_ INT ipfd, + _In_ UINT cjpfd, + _When_(cjpfd != 0, _Out_) PPIXELFORMATDESCRIPTOR ppfd) { PDC pdc; PPDEVOBJ ppdev; INT Ret = 0; PIXELFORMATDESCRIPTOR pfdSafe; - NTSTATUS Status = STATUS_SUCCESS;
- if (!BufSize) return 0; + if ((ppfd == NULL) && (cjpfd != 0)) return 0;
- pdc = DC_LockDc(hDC); + pdc = DC_LockDc(hdc); if (!pdc) { EngSetLastError(ERROR_INVALID_HANDLE); @@ -63,10 +63,8 @@
if (!pdc->ipfdDevMax) IntGetipfdDevMax(pdc);
- if ( BufSize < sizeof(PIXELFORMATDESCRIPTOR) || - PixelFormat < 1 || - PixelFormat > pdc->ipfdDevMax ) - { + if ((ipfd < 1) || (ipfd > pdc->ipfdDevMax)) + { EngSetLastError(ERROR_INVALID_PARAMETER); goto Exit; } @@ -83,25 +81,25 @@ { Ret = ppdev->DriverFunctions.DescribePixelFormat( ppdev->dhpdev, - PixelFormat, - sizeof(PIXELFORMATDESCRIPTOR), + ipfd, + sizeof(pfdSafe), &pfdSafe); }
- _SEH2_TRY + if (Ret && cjpfd) { - ProbeForWrite( pfd, - sizeof(PIXELFORMATDESCRIPTOR), - 1); - RtlCopyMemory(&pfdSafe, pfd, sizeof(PIXELFORMATDESCRIPTOR)); + _SEH2_TRY + { + cjpfd = min(cjpfd, sizeof(PIXELFORMATDESCRIPTOR)); + ProbeForWrite(ppfd, cjpfd, 1); + RtlCopyMemory(ppfd, &pfdSafe, cjpfd); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastNtError(_SEH2_GetExceptionCode()); + } + _SEH2_END; } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) SetLastNtError(Status);
Exit: DC_UnlockDc(pdc); @@ -133,7 +131,7 @@
if ( ipfd < 1 || ipfd > pdc->ipfdDevMax ) - { + { EngSetLastError(ERROR_INVALID_PARAMETER); goto Exit; }
Modified: trunk/reactos/win32ss/user/ntuser/class.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/class.h... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/class.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/class.h [iso-8859-1] Wed Aug 1 09:17:55 2012 @@ -48,8 +48,10 @@ IN PCALLPROCDATA CallProc);
BOOL -IntGetAtomFromStringOrAtom(IN PUNICODE_STRING ClassName, - OUT RTL_ATOM *Atom); +NTAPI +IntGetAtomFromStringOrAtom( + _In_ PUNICODE_STRING ClassName, + _Out_ RTL_ATOM *Atom);
BOOL IntCheckProcessDesktopClasses(IN PDESKTOP Desktop,