[ros-diffs] [gedmurphy] 29952: speed up the DrawIconEx alpha maths a little bit

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Mon Oct 29 14:29:26 CET 2007


Author: gedmurphy
Date: Mon Oct 29 16:29:26 2007
New Revision: 29952

URL: http://svn.reactos.org/svn/reactos?rev=29952&view=rev
Log:
speed up the DrawIconEx alpha maths a little bit

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=29952&r1=29951&r2=29952&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Mon Oct 29 16:29:26 2007
@@ -1520,6 +1520,7 @@
         BITMAPOBJ *BitmapObj = NULL;
         PBYTE pBits = NULL;
         BLENDFUNCTION  BlendFunc;
+        DWORD Pixel;
         BYTE Red, Green, Blue, Alpha;
         DWORD Count = 0;
         INT i, j;
@@ -1548,23 +1549,16 @@
         {
             for (j = 0; j < cxWidth; j++)
             {
-                DWORD OrigPixel = 0;
-                DWORD AlphaPixel = 0;
-
-                OrigPixel = *(DWORD *)(pBits + Count);
-
-                Red   = (BYTE)((OrigPixel >>  0) & 0xff);
-                Green = (BYTE)((OrigPixel >>  8) & 0xff);
-                Blue  = (BYTE)((OrigPixel >> 16) & 0xff);
-                Alpha = (BYTE)((OrigPixel >> 24) & 0xff);
-
-                Red = (Red * Alpha) / 0xff;
-                Green = (Green * Alpha) / 0xff;
-                Blue = (Blue * Alpha) / 0xff;
-
-                AlphaPixel = (DWORD)(Red | (Green << 8) | (Blue << 16) | (Alpha << 24));
-
-                *(DWORD *)(pBits + Count) = AlphaPixel;
+                Pixel = *(DWORD *)(pBits + Count);
+
+                Alpha = ((BYTE)(Pixel >> 24) & 0xff);
+
+                Red   = (((BYTE)(Pixel >>  0) & 0xff) * Alpha) / 0xff;
+                Green = (((BYTE)(Pixel >>  8) & 0xff) * Alpha) / 0xff;
+                Blue  = (((BYTE)(Pixel >> 16) & 0xff) * Alpha) / 0xff;
+
+                *(DWORD *)(pBits + Count) = (DWORD)(Red | (Green << 8) | (Blue << 16) | (Alpha << 24));
+
                 Count += sizeof (DWORD);
             }
         }




More information about the Ros-diffs mailing list