- 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
while(DstX < DestRect->right)
{
SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
while(DstX < DestRect->right)
{
SrcPixel32.ul = DIB_GetSource(Source, SrcX, SrcY, &exloSrcRGB.xlo);
- SrcPixel32.col.red *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel32.col.green *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel32.col.blue *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel32.col.alpha = (32 == SrcBpp) ?
- SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha / 255 :
- BlendFunc.SourceConstantAlpha ;
+ SrcPixel32.col.red = (SrcPixel32.col.red * BlendFunc.SourceConstantAlpha) / 255;
+ SrcPixel32.col.green = (SrcPixel32.col.green * BlendFunc.SourceConstantAlpha) / 255;
+ SrcPixel32.col.blue = (SrcPixel32.col.blue * BlendFunc.SourceConstantAlpha) / 255;
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.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.alpha = Clamp8(DstPixel32.col.alpha * (255 - Alpha) / 255 + SrcPixel32.col.alpha) ;
+ 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.blue = Clamp8((DstPixel32.col.blue * (255 - Alpha)) / 255 + SrcPixel32.col.blue) ;
DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul);
pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul));
DstPixel32.ul = XLATEOBJ_iXlate(&exloRGBSrc.xlo, DstPixel32.ul);
pfnDibPutPixel(Dest, DstX, DstY, XLATEOBJ_iXlate(ColorTranslation, DstPixel32.ul));
SrcX = SourceRect->left;
while (++Cols <= DestRect->right - DestRect->left)
{
SrcX = SourceRect->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);
- SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255;
- Alpha = BlendFunc.SourceConstantAlpha ;
+ Alpha = BlendFunc.SourceConstantAlpha ;
- SrcPixel.ul = DIB_GetSourceIndex(Source, SrcX, SrcY);
- 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;
+ Alpha = (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255;
- DstPixel.col.red = (*Dst) * (255 - Alpha) / 255 + SrcPixel.col.red ;
- DstPixel.col.green = *(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green ;
- DstPixel.col.blue = *(Dst+2) * (255 - Alpha) / 255 + SrcPixel.col.blue ;
+ DstPixel.col.red = Clamp8((*Dst * (255 - Alpha)) / 255 + SrcPixel.col.red) ;
+ DstPixel.col.green = Clamp8((*(Dst+1) * (255 - Alpha) / 255 + SrcPixel.col.green)) ;
+ DstPixel.col.blue = Clamp8((*(Dst+2) * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
*Dst++ = DstPixel.col.red;
*Dst++ = DstPixel.col.green;
*Dst++ = DstPixel.col.blue;
*Dst++ = DstPixel.col.red;
*Dst++ = DstPixel.col.green;
*Dst++ = DstPixel.col.blue;
while (++Cols <= DestRect->right - DestRect->left)
{
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
while (++Cols <= DestRect->right - DestRect->left)
{
SrcPixel.ul = DIB_GetSource(Source, SrcX, SrcY, ColorTranslation);
- SrcPixel.col.red *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel.col.green *= BlendFunc.SourceConstantAlpha / 255;
- SrcPixel.col.blue *= BlendFunc.SourceConstantAlpha / 255;
+ 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;
SrcPixel.col.alpha = (32 == SrcBpp) ?
SrcPixel.col.alpha = (32 == SrcBpp) ?
- SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha / 255 :
+ (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
BlendFunc.SourceConstantAlpha ;
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
DstPixel.ul = *Dst;
BlendFunc.SourceConstantAlpha ;
Alpha = ((BlendFunc.AlphaFormat & AC_SRC_ALPHA) != 0) ?
SrcPixel.col.alpha : BlendFunc.SourceConstantAlpha ;
DstPixel.ul = *Dst;
- 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.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.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.blue = Clamp8((DstPixel.col.blue * (255 - Alpha)) / 255 + SrcPixel.col.blue) ;
+ DstPixel.col.alpha = Clamp8((DstPixel.col.alpha * (255 - Alpha)) / 255 + SrcPixel.col.alpha) ;
*Dst++ = DstPixel.ul;
SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
}
*Dst++ = DstPixel.ul;
SrcX = SourceRect->left + (Cols*(SourceRect->right - SourceRect->left))/(DestRect->right - DestRect->left);
}