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

Alexandre Julliard julliard at winehq.org
Wed Nov 30 14:19:21 CST 2011


Module: wine
Branch: master
Commit: 174d2f6d72681c3acec0f8b0c6e41c1e4ca19e9f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=174d2f6d72681c3acec0f8b0c6e41c1e4ca19e9f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Nov 30 14:26:25 2011 +0100

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

---

 dlls/user32/nonclient.c |   55 +++++++++++++++++++---------------------------
 1 files changed, 23 insertions(+), 32 deletions(-)

diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c
index d2bcdcb..6bef9ff 100644
--- a/dlls/user32/nonclient.c
+++ b/dlls/user32/nonclient.c
@@ -182,55 +182,46 @@ static void NC_DrawCaptionBar (HDC hdc, const RECT *rect, DWORD dwStyle,
 {
     if (gradient)
     {
-        TRIVERTEX vertices[6];
+        TRIVERTEX vertices[4];
         DWORD colLeft = 
             GetSysColor (active ? COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION);
         DWORD colRight = 
             GetSysColor (active ? COLOR_GRADIENTACTIVECAPTION 
                                 : COLOR_GRADIENTINACTIVECAPTION);
-        int v;
         int buttonsAreaSize = GetSystemMetrics(SM_CYCAPTION) - 1;
-        static GRADIENT_RECT mesh[] = {{0, 1}, {2, 3}, {4, 5}};
-    
-        for (v = 0; v < 3; v++)
-        {
-            vertices[v].Red = GetRValue (colLeft) << 8;
-            vertices[v].Green = GetGValue (colLeft) << 8;
-            vertices[v].Blue = GetBValue (colLeft) << 8;
-            vertices[v].Alpha = 0x8000;
-            vertices[v+3].Red = GetRValue (colRight) << 8;
-            vertices[v+3].Green = GetGValue (colRight) << 8;
-            vertices[v+3].Blue = GetBValue (colRight) << 8;
-            vertices[v+3].Alpha = 0x8000;
-        }
-    
-        if ((dwStyle & WS_SYSMENU) 
+        static GRADIENT_RECT mesh[] = {{0, 1}, {1, 2}, {2, 3}};
+
+        vertices[0].Red   = vertices[1].Red   = GetRValue (colLeft) << 8;
+        vertices[0].Green = vertices[1].Green = GetGValue (colLeft) << 8;
+        vertices[0].Blue  = vertices[1].Blue  = GetBValue (colLeft) << 8;
+        vertices[0].Alpha = vertices[1].Alpha = 0xff00;
+        vertices[2].Red   = vertices[3].Red   = GetRValue (colRight) << 8;
+        vertices[2].Green = vertices[3].Green = GetGValue (colRight) << 8;
+        vertices[2].Blue  = vertices[3].Blue  = GetBValue (colRight) << 8;
+        vertices[2].Alpha = vertices[3].Alpha = 0xff00;
+
+        if ((dwStyle & WS_SYSMENU)
             && ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX)))
             buttonsAreaSize += 2 * (GetSystemMetrics(SM_CXSIZE) + 1);
-        
+
         /* area behind icon; solid filled with left color */
         vertices[0].x = rect->left;
         vertices[0].y = rect->top;
-        if (dwStyle & WS_SYSMENU) 
-            vertices[1].x = 
-                min (rect->left + GetSystemMetrics(SM_CXSMICON), rect->right);
+        if (dwStyle & WS_SYSMENU)
+            vertices[1].x = min (rect->left + GetSystemMetrics(SM_CXSMICON), rect->right);
         else
             vertices[1].x = vertices[0].x;
         vertices[1].y = rect->bottom;
-        
+
         /* 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[3].x = max (vertices[2].x, rect->right - buttonsAreaSize);
-        vertices[3].y = rect->bottom;
-        
+
         /* area behind buttons; solid filled with right color */
-        vertices[4].x = vertices[3].x;
-        vertices[4].y = rect->top;
-        vertices[5].x = rect->right;
-        vertices[5].y = rect->bottom;
-        
-        GdiGradientFill (hdc, vertices, 6, mesh, 3, GRADIENT_FILL_RECT_H);
+        vertices[3].x = rect->right;
+        vertices[3].y = rect->bottom;
+
+        GdiGradientFill (hdc, vertices, 4, mesh, 3, GRADIENT_FILL_RECT_H);
     }
     else
         FillRect (hdc, rect, GetSysColorBrush (active ?




More information about the wine-cvs mailing list