Author: jgardou
Date: Sun Aug  8 16:20:24 2010
New Revision: 48488

URL: http://svn.reactos.org/svn/reactos?rev=48488&view=rev
Log:
[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.

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c
    branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c
    branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c?rev=48488&r1=48487&r2=48488&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c 
[iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/dib/alphablend.c 
[iso-8859-1] Sun Aug  8 16:20:24 2010
@@ -90,21 +90,18 @@
     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) ?
-           SrcPixel32.col.alpha : BlendFunc.SourceConstantAlpha ;
+           (SrcPixel32.col.alpha * BlendFunc.SourceConstantAlpha) / 255 :
+           BlendFunc.SourceConstantAlpha ;
 
       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));
 

Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c?rev=48488&r1=48487&r2=48488&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c 
[iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib24bpp.c 
[iso-8859-1] Sun Aug  8 16:20:24 2010
@@ -509,28 +509,22 @@
     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))
       {
-        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 ;
       }
       else
       {
-        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;
-      }
-
-      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 ;
+        Alpha = (SrcPixel.col.alpha * BlendFunc.SourceConstantAlpha) / 255;
+      }
+
+      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;

Modified: branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c
URL: 
http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c?rev=48488&r1=48487&r2=48488&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c 
[iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/dib/dib32bpp.c 
[iso-8859-1] Sun Aug  8 16:20:24 2010
@@ -392,21 +392,21 @@
     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 * 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;
-      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);
     }


Reply via email to