mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 17:30:32 +00:00
[WIN32K]
- I watch and I learn : / has precedence over *=. - Also make sure that we divide what we want to divide with the appropriate parentheses. - Do not take care of alpha in other depths than 32 bpp. svn path=/branches/reactos-yarotows/; revision=48488
This commit is contained in:
parent
1784002600
commit
d4933ee771
3 changed files with 25 additions and 34 deletions
|
@ -90,21 +90,18 @@ DIB_XXBPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
while(DstX < DestRect->right)
|
while(DstX < DestRect->right)
|
||||||
{
|
{
|
||||||
SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
|
SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
|
||||||
SrcPixel32.col.red *= BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel32.col.green *= BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel32.col.blue *= BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel32.col.alpha = (32 == SrcBpp) ?
|
|
||||||
SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255 :
|
|
||||||
BlendFunc.SourceConstantAlpha ;
|
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
||||||
SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha ;
|
(SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
|
||||||
|
BlendFunc.SourceConstantAlpha ;
|
||||||
|
|
||||||
DstPixel32.ul = DIB_GetSource(Dest, DstX, DstY, &exloDstRGB.xlo);
|
DstPixel32.ul = DIB_GetSource(Dest, DstX, DstY, &exloDstRGB.xlo);
|
||||||
DstPixel32.col.red = Clamp8(DstPixel32.col.red * (255 - Alpha) / 255 + SrcPixel32.col.red) ;
|
DstPixel32.col.red = Clamp8((DstPixel32.col.red * (255 - Alpha)) / 255 + SrcPixel32.col.red) ;
|
||||||
DstPixel32.col.green = Clamp8(DstPixel32.col.green * (255 - Alpha) / 255 + SrcPixel32.col.green) ;
|
DstPixel32.col.green = Clamp8((DstPixel32.col.green * (255 - Alpha)) / 255 + SrcPixel32.col.green) ;
|
||||||
DstPixel32.col.blue = Clamp8(DstPixel32.col.blue * (255 - Alpha) / 255 + SrcPixel32.col.blue) ;
|
DstPixel32.col.blue = Clamp8((DstPixel32.col.blue * (255 - Alpha)) / 255 + SrcPixel32.col.blue) ;
|
||||||
DstPixel32.col.alpha = Clamp8(DstPixel32.col.alpha * (255 - Alpha) / 255 + SrcPixel32.col.alpha) ;
|
|
||||||
DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul);
|
DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul);
|
||||||
pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul));
|
pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul));
|
||||||
|
|
||||||
|
|
|
@ -509,28 +509,22 @@ DIB_24BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
SrcX = SourceRect->left;
|
SrcX = SourceRect->left;
|
||||||
while (++Cols <= DestRect->right - DestRect->left)
|
while (++Cols <= DestRect->right - DestRect->left)
|
||||||
{
|
{
|
||||||
|
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
|
||||||
|
SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
|
SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
if (!(BlendFunc.AlphaFormat & AC_SRC_ALPHA))
|
if (!(BlendFunc.AlphaFormat & AC_SRC_ALPHA))
|
||||||
{
|
{
|
||||||
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
|
Alpha = BlendFunc.SourceConstantAlpha ;
|
||||||
SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
Alpha = BlendFunc.SourceConstantAlpha ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SrcPixel.ul = DIB_GetSourceIndex(Source, SrcX, SrcY);
|
Alpha = (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
SrcPixel.col.alpha *= BlendFunc.SourceConstantAlpha / 255;
|
|
||||||
|
|
||||||
Alpha = SrcPixel.col.alpha;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DstPixel.col.red = (*Dst) * (255 - Alpha) / 255 + SrcPixel.col.red ;
|
DstPixel.col.red = Clamp8((*Dst * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
|
||||||
DstPixel.col.green = *(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green ;
|
DstPixel.col.green = Clamp8((*(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green)) ;
|
||||||
DstPixel.col.blue = *(Dst+2) * (255 - Alpha) / 255 + SrcPixel.col.blue ;
|
DstPixel.col.blue = Clamp8((*(Dst+2) * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
|
||||||
*Dst++ = DstPixel.col.red;
|
*Dst++ = DstPixel.col.red;
|
||||||
*Dst++ = DstPixel.col.green;
|
*Dst++ = DstPixel.col.green;
|
||||||
*Dst++ = DstPixel.col.blue;
|
*Dst++ = DstPixel.col.blue;
|
||||||
|
|
|
@ -392,21 +392,21 @@ DIB_32BPP_AlphaBlend(SURFOBJ* Dest, SURFOBJ* Source, RECTL* DestRect,
|
||||||
while (++Cols <= DestRect->right - DestRect->left)
|
while (++Cols <= DestRect->right - DestRect->left)
|
||||||
{
|
{
|
||||||
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
|
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
|
||||||
SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel.col.red = (SrcPixel.col.red * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel.col.green = (SrcPixel.col.green * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255;
|
SrcPixel.col.blue = (SrcPixel.col.blue * BlendFunc.SourceConstantAlpha) / 255;
|
||||||
SrcPixel.col.alpha = (32 == SrcBpp) ?
|
SrcPixel.col.alpha = (32 == SrcBpp) ?
|
||||||
SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255 :
|
(SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
|
||||||
BlendFunc.SourceConstantAlpha ;
|
BlendFunc.SourceConstantAlpha ;
|
||||||
|
|
||||||
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
|
||||||
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
|
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
|
||||||
|
|
||||||
DstPixel.ul = *Dst;
|
DstPixel.ul = *Dst;
|
||||||
DstPixel.col.red = Clamp8(DstPixel.col.red * (255 - Alpha) / 255 + SrcPixel.col.red) ;
|
DstPixel.col.red = Clamp8((DstPixel.col.red * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
|
||||||
DstPixel.col.green = Clamp8(DstPixel.col.green * (255 - Alpha) / 255 + SrcPixel.col.green) ;
|
DstPixel.col.green = Clamp8((DstPixel.col.green * (255 - Alpha)) / 255 + SrcPixel.col.green) ;
|
||||||
DstPixel.col.blue = Clamp8(DstPixel.col.blue * (255 - Alpha) / 255 + SrcPixel.col.blue) ;
|
DstPixel.col.blue = Clamp8((DstPixel.col.blue * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
|
||||||
DstPixel.col.alpha = Clamp8(DstPixel.col.alpha * (255 - Alpha) / 255 + SrcPixel.col.alpha) ;
|
DstPixel.col.alpha = Clamp8((DstPixel.col.alpha * (255 - Alpha)) / 255 + SrcPixel.col.alpha) ;
|
||||||
*Dst++ = DstPixel.ul;
|
*Dst++ = DstPixel.ul;
|
||||||
SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
|
SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue