[NTGDI] Fix gradient offset handling

- Offset vertex array to the current DC's coordinates for rectangular gradients. Don't change anything for triangular gradients. This is more correct regarding to how Windows XP/2003 handles that and debugging analysis shows the same behaviour there.
- Additionally, fix checking mode condition for triangles on parameters validation. It should actually be checked for an equalness, not via bitwise "OR", since only one mode type can be set for ulMode parameter for GradientFill() according to MSDN.

This avoids incorrect gradient coordinates passed to DrvGradientFill() in case it's supported by the display/video driver, so now gradients are drawing at the correct position as they should.
Hence, this fixes broken gradients in window captions (always painted at the top left corner) on real hardware with native video drivers (AMD/ATI/Intel/Nvidia etc.). Tested successfully on Asus-F5R notebook with ATI Radeon XPress 1100 + ATI Catalyst 10.2 video driver at least.
CORE-14927, CORE-15341
This commit is contained in:
Oleg Dubinskiy
2026-01-19 11:39:28 +01:00
parent afc4f33b20
commit 3a763d2126
+13 -1
View File
@@ -954,7 +954,7 @@ GreGradientFill(
BOOL bRet;
/* Check parameters */
if (ulMode & GRADIENT_FILL_TRIANGLE)
if (ulMode == GRADIENT_FILL_TRIANGLE)
{
PGRADIENT_TRIANGLE pTriangle = (PGRADIENT_TRIANGLE)pMesh;
@@ -1020,6 +1020,18 @@ GreGradientFill(
return TRUE;
}
/* Offset vertex for rectangles */
if (ulMode == GRADIENT_FILL_RECT_H ||
ulMode == GRADIENT_FILL_RECT_V)
{
for (i = 0; i < nVertex; i++)
{
IntLPtoDP(pdc, (LPPOINT)&pVertex[i], 1);
pVertex[i].x += pdc->ptlDCOrig.x;
pVertex[i].y += pdc->ptlDCOrig.y;
}
}
ptlDitherOrg.x = ptlDitherOrg.y = 0;
IntLPtoDP(pdc, (LPPOINT)&ptlDitherOrg, 1);