forget remove a calc value in the for loop it can do outside the loop.
authorMagnus Olsen <magnus@greatlord.com>
Tue, 3 Jan 2006 17:21:11 +0000 (17:21 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Tue, 3 Jan 2006 17:21:11 +0000 (17:21 +0000)
svn path=/trunk/; revision=20548

reactos/subsys/win32k/dib/dib16bpp.c

index 8b5751a..5e81602 100644 (file)
@@ -649,16 +649,17 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                              CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
                              ULONG Mode)
 {
                              CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
                              ULONG Mode)
 {
-   int SrcSizeY;
-   int SrcSizeX;
-   int DesSizeY;
-   int DesSizeX;      
-   int sx;
-   int sy;
-   int DesX;
-   int DesY;
-   int color;
+   LONG SrcSizeY;
+   LONG SrcSizeX;
+   LONG DesSizeY;
+   LONG DesSizeX;      
+   LONG sx;
+   LONG sy;
+   LONG DesX;
+   LONG DesY;
+   LONG color;
    PULONG DestBits;
    PULONG DestBits;
+   LONG DifflDelta;
 
   
   DPRINT("DIB_16BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
 
   
   DPRINT("DIB_16BPP_StretchBlt: Source BPP: %u, srcRect: (%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
@@ -680,7 +681,9 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
       
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
       
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
-                      
+      
+         DifflDelta = DestSurf->lDelta -  (DesSizeX << 1); 
+                         
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
@@ -701,7 +704,7 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                                     DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
                   }
             }
                                     DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
                   }
             }
-            DestBits = (PULONG)((ULONG_PTR)DestBits - (DesSizeX << 1) + DestSurf->lDelta);
+            DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
        }
        break;
 
        }
        break;
 
@@ -711,7 +714,9 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
 
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
 
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
-                      
+      
+         DifflDelta = DestSurf->lDelta -  (DesSizeX << 1); 
+                         
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
@@ -725,7 +730,7 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
-            DestBits = (PULONG)((ULONG_PTR)DestBits - (DesSizeX << 1) + DestSurf->lDelta);
+            DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
        }
        break;
        
        }
        break;
        
@@ -735,6 +740,8 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
             
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
             
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
+                   
+      DifflDelta = DestSurf->lDelta -  (DesSizeX << 1); 
                       
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
                       
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
@@ -749,7 +756,7 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
-            DestBits = (PULONG)((ULONG_PTR)DestBits - (DesSizeX << 1) + DestSurf->lDelta);
+            DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
        }
        break;
        
        }
        break;
        
@@ -760,7 +767,9 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                       
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
                       
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
-                      
+      
+         DifflDelta = DestSurf->lDelta -  (DesSizeX << 1); 
+                         
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
@@ -774,8 +783,9 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
-            DestBits = (PULONG)((ULONG_PTR)DestBits - (DesSizeX << 1) + DestSurf->lDelta);
-       }       break;
+            DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
+       }       
+          break;
 
       case BMF_32BPP:          
       /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
 
       case BMF_32BPP:          
       /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
@@ -783,7 +793,9 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                       
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
                       
       DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) +
                    DestRect->top * DestSurf->lDelta);
-                      
+      
+         DifflDelta = DestSurf->lDelta -  (DesSizeX << 1); 
+                         
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
        for (DesY=0; DesY<DesSizeY; DesY++)
        {        
             sy = ((DesY  * SrcSizeY) / DesSizeY) + SourceRect->top;
@@ -797,7 +809,7 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
                                  *DestBits = XLATEOBJ_iXlate(ColorTranslation, color);                                                           
                                   DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
             }
-            DestBits = (PULONG)((ULONG_PTR)DestBits - (DesSizeX << 1) + DestSurf->lDelta);
+            DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
        }
        break;
 
        }
        break;