Commit 174d2f6d authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Use the correct alpha for the title bar gradient and simplify the mesh.

parent 76358216
...@@ -182,55 +182,46 @@ static void NC_DrawCaptionBar (HDC hdc, const RECT *rect, DWORD dwStyle, ...@@ -182,55 +182,46 @@ static void NC_DrawCaptionBar (HDC hdc, const RECT *rect, DWORD dwStyle,
{ {
if (gradient) if (gradient)
{ {
TRIVERTEX vertices[6]; TRIVERTEX vertices[4];
DWORD colLeft = DWORD colLeft =
GetSysColor (active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION); GetSysColor (active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION);
DWORD colRight = DWORD colRight =
GetSysColor (active ? COLOR_GRADIENTACTIVECAPTION GetSysColor (active ? COLOR_GRADIENTACTIVECAPTION
: COLOR_GRADIENTINACTIVECAPTION); : COLOR_GRADIENTINACTIVECAPTION);
int v;
int buttonsAreaSize = GetSystemMetrics(SM_CYCAPTION) - 1; int buttonsAreaSize = GetSystemMetrics(SM_CYCAPTION) - 1;
static GRADIENT_RECT mesh[] = {{0, 1}, {2, 3}, {4, 5}}; static GRADIENT_RECT mesh[] = {{0, 1}, {1, 2}, {2, 3}};
for (v = 0; v < 3; v++) vertices[0].Red = vertices[1].Red = GetRValue (colLeft) << 8;
{ vertices[0].Green = vertices[1].Green = GetGValue (colLeft) << 8;
vertices[v].Red = GetRValue (colLeft) << 8; vertices[0].Blue = vertices[1].Blue = GetBValue (colLeft) << 8;
vertices[v].Green = GetGValue (colLeft) << 8; vertices[0].Alpha = vertices[1].Alpha = 0xff00;
vertices[v].Blue = GetBValue (colLeft) << 8; vertices[2].Red = vertices[3].Red = GetRValue (colRight) << 8;
vertices[v].Alpha = 0x8000; vertices[2].Green = vertices[3].Green = GetGValue (colRight) << 8;
vertices[v+3].Red = GetRValue (colRight) << 8; vertices[2].Blue = vertices[3].Blue = GetBValue (colRight) << 8;
vertices[v+3].Green = GetGValue (colRight) << 8; vertices[2].Alpha = vertices[3].Alpha = 0xff00;
vertices[v+3].Blue = GetBValue (colRight) << 8;
vertices[v+3].Alpha = 0x8000; if ((dwStyle & WS_SYSMENU)
}
if ((dwStyle & WS_SYSMENU)
&& ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))) && ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX)))
buttonsAreaSize += 2 * (GetSystemMetrics(SM_CXSIZE) + 1); buttonsAreaSize += 2 * (GetSystemMetrics(SM_CXSIZE) + 1);
/* area behind icon; solid filled with left color */ /* area behind icon; solid filled with left color */
vertices[0].x = rect->left; vertices[0].x = rect->left;
vertices[0].y = rect->top; vertices[0].y = rect->top;
if (dwStyle & WS_SYSMENU) if (dwStyle & WS_SYSMENU)
vertices[1].x = vertices[1].x = min (rect->left + GetSystemMetrics(SM_CXSMICON), rect->right);
min (rect->left + GetSystemMetrics(SM_CXSMICON), rect->right);
else else
vertices[1].x = vertices[0].x; vertices[1].x = vertices[0].x;
vertices[1].y = rect->bottom; vertices[1].y = rect->bottom;
/* area behind text; gradient */ /* area behind text; gradient */
vertices[2].x = vertices[1].x; vertices[2].x = max (vertices[1].x, rect->right - buttonsAreaSize);
vertices[2].y = rect->top; vertices[2].y = rect->top;
vertices[3].x = max (vertices[2].x, rect->right - buttonsAreaSize);
vertices[3].y = rect->bottom;
/* area behind buttons; solid filled with right color */ /* area behind buttons; solid filled with right color */
vertices[4].x = vertices[3].x; vertices[3].x = rect->right;
vertices[4].y = rect->top; vertices[3].y = rect->bottom;
vertices[5].x = rect->right;
vertices[5].y = rect->bottom; GdiGradientFill (hdc, vertices, 4, mesh, 3, GRADIENT_FILL_RECT_H);
GdiGradientFill (hdc, vertices, 6, mesh, 3, GRADIENT_FILL_RECT_H);
} }
else else
FillRect (hdc, rect, GetSysColorBrush (active ? FillRect (hdc, rect, GetSysColorBrush (active ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment