diff --git a/reactos/win32ss/gdi/eng/alphablend.c b/reactos/win32ss/gdi/eng/alphablend.c index b669f4f5f66..d760866223b 100644 --- a/reactos/win32ss/gdi/eng/alphablend.c +++ b/reactos/win32ss/gdi/eng/alphablend.c @@ -141,7 +141,7 @@ EngAlphaBlend(IN SURFOBJ *psoDest, 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 @@ EngAlphaBlend(IN SURFOBJ *psoDest, 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 @@ EngAlphaBlend(IN SURFOBJ *psoDest, 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(prclDest); + ASSERT(prclSrc); + //ASSERT(pBlendObj); - ASSERT(DestRect); - ASSERT(SourceRect); + /* 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); + psoDest, psoSource, pco, pxlo, + prclDest, prclSrc, pBlendObj); } - if (! ret) + if (!ret) { - ret = EngAlphaBlend(psoDest, psoSource, ClipRegion, ColorTranslation, - DestRect, SourceRect, BlendObj); + ret = EngAlphaBlend(psoDest, psoSource, pco, pxlo, + prclDest, prclSrc, pBlendObj); } return ret; diff --git a/reactos/win32ss/gdi/eng/pdevobj.c b/reactos/win32ss/gdi/eng/pdevobj.c index d64edc25107..b890f474ef1 100644 --- a/reactos/win32ss/gdi/eng/pdevobj.c +++ b/reactos/win32ss/gdi/eng/pdevobj.c @@ -291,14 +291,14 @@ EngpCreatePDEV( { /* ... 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 @@ APIENTRY EngGetDriverName(IN HDEV hdev) { PPDEVOBJ ppdev = (PPDEVOBJ)hdev; - PLDEVOBJ pldev; - if (!hdev) - return NULL; + ASSERT(ppdev); + ASSERT(ppdev->pldev); + ASSERT(ppdev->pldev->pGdiDriverInfo); + ASSERT(ppdev->pldev->pGdiDriverInfo->DriverName.Buffer); - pldev = ppdev->pldev; - ASSERT(pldev); - - if (!pldev->pGdiDriverInfo) - return NULL; - - return pldev->pGdiDriverInfo->DriverName.Buffer; + return ppdev->pldev->pGdiDriverInfo->DriverName.Buffer; } diff --git a/reactos/win32ss/gdi/ntgdi/arc.c b/reactos/win32ss/gdi/ntgdi/arc.c index c71a7a38444..41cc1c46ec2 100644 --- a/reactos/win32ss/gdi/ntgdi/arc.c +++ b/reactos/win32ss/gdi/ntgdi/arc.c @@ -57,12 +57,17 @@ IntArc( DC *dc, { 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; diff --git a/reactos/win32ss/gdi/ntgdi/dcutil.c b/reactos/win32ss/gdi/ntgdi/dcutil.c index 0ae3d53cb32..a740f3e8cda 100644 --- a/reactos/win32ss/gdi/ntgdi/dcutil.c +++ b/reactos/win32ss/gdi/ntgdi/dcutil.c @@ -332,13 +332,13 @@ NtGdiGetDCDword( 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 @@ NtGdiGetAndSetDCDword( 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 @@ NtGdiGetAndSetDCDword( { _SEH2_TRY { - ProbeForWrite(Result, sizeof(DWORD), 1); - *Result = SafeResult; + ProbeForWrite(pdwResult, sizeof(DWORD), 1); + *pdwResult = SafeResult; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { diff --git a/reactos/win32ss/gdi/ntgdi/wingl.c b/reactos/win32ss/gdi/ntgdi/wingl.c index 1d9e7b6b6b8..4a4117e2f00 100644 --- a/reactos/win32ss/gdi/ntgdi/wingl.c +++ b/reactos/win32ss/gdi/ntgdi/wingl.c @@ -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 @@ -38,23 +38,23 @@ IntGetipfdDevMax(PDC pdc) 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 @@ NtGdiDescribePixelFormat(HDC hDC, 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 @@ NtGdiDescribePixelFormat(HDC hDC, { 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 @@ NtGdiSetPixelFormat( if ( ipfd < 1 || ipfd > pdc->ipfdDevMax ) - { + { EngSetLastError(ERROR_INVALID_PARAMETER); goto Exit; } diff --git a/reactos/win32ss/user/ntuser/class.h b/reactos/win32ss/user/ntuser/class.h index e2b5cb59d62..d6603b64418 100644 --- a/reactos/win32ss/user/ntuser/class.h +++ b/reactos/win32ss/user/ntuser/class.h @@ -48,8 +48,10 @@ UserAddCallProcToClass(IN OUT PCLS Class, 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,