mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 11:06:42 +00:00
speed up the DrawIconEx alpha maths a little bit
svn path=/trunk/; revision=29952
This commit is contained in:
parent
fb7e8a4777
commit
af97264c80
1 changed files with 7 additions and 13 deletions
|
@ -1520,6 +1520,7 @@ UserDrawIconEx(
|
||||||
BITMAPOBJ *BitmapObj = NULL;
|
BITMAPOBJ *BitmapObj = NULL;
|
||||||
PBYTE pBits = NULL;
|
PBYTE pBits = NULL;
|
||||||
BLENDFUNCTION BlendFunc;
|
BLENDFUNCTION BlendFunc;
|
||||||
|
DWORD Pixel;
|
||||||
BYTE Red, Green, Blue, Alpha;
|
BYTE Red, Green, Blue, Alpha;
|
||||||
DWORD Count = 0;
|
DWORD Count = 0;
|
||||||
INT i, j;
|
INT i, j;
|
||||||
|
@ -1548,23 +1549,16 @@ UserDrawIconEx(
|
||||||
{
|
{
|
||||||
for (j = 0; j < cxWidth; j++)
|
for (j = 0; j < cxWidth; j++)
|
||||||
{
|
{
|
||||||
DWORD OrigPixel = 0;
|
Pixel = *(DWORD *)(pBits + Count);
|
||||||
DWORD AlphaPixel = 0;
|
|
||||||
|
|
||||||
OrigPixel = *(DWORD *)(pBits + Count);
|
Alpha = ((BYTE)(Pixel >> 24) & 0xff);
|
||||||
|
|
||||||
Red = (BYTE)((OrigPixel >> 0) & 0xff);
|
Red = (((BYTE)(Pixel >> 0) & 0xff) * Alpha) / 0xff;
|
||||||
Green = (BYTE)((OrigPixel >> 8) & 0xff);
|
Green = (((BYTE)(Pixel >> 8) & 0xff) * Alpha) / 0xff;
|
||||||
Blue = (BYTE)((OrigPixel >> 16) & 0xff);
|
Blue = (((BYTE)(Pixel >> 16) & 0xff) * Alpha) / 0xff;
|
||||||
Alpha = (BYTE)((OrigPixel >> 24) & 0xff);
|
|
||||||
|
|
||||||
Red = (Red * Alpha) / 0xff;
|
*(DWORD *)(pBits + Count) = (DWORD)(Red | (Green << 8) | (Blue << 16) | (Alpha << 24));
|
||||||
Green = (Green * Alpha) / 0xff;
|
|
||||||
Blue = (Blue * Alpha) / 0xff;
|
|
||||||
|
|
||||||
AlphaPixel = (DWORD)(Red | (Green << 8) | (Blue << 16) | (Alpha << 24));
|
|
||||||
|
|
||||||
*(DWORD *)(pBits + Count) = AlphaPixel;
|
|
||||||
Count += sizeof (DWORD);
|
Count += sizeof (DWORD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue