fixed working strechblt for all dibxx now. do not say it does not take offset of source and destantion into accunt, it does. left implement CliprRegion. but last no longer black windows with or corupt images showing.
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib4bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c

Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
--- trunk/reactos/subsys/win32k/dib/dib1bpp.c	2006-01-06 02:25:12 UTC (rev 20601)
+++ trunk/reactos/subsys/win32k/dib/dib1bpp.c	2006-01-06 05:27:48 UTC (rev 20602)
@@ -502,793 +502,130 @@
                             CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
                             ULONG Mode)
 {
-   int SrcSizeY;
-   int SrcSizeX;
-   int DesSizeY;
-   int DesSizeX;      
-   int sx;
-   int sy;
-   int DesX;
-   int DesY;
-   int color;
-   int zoomX;
-   int zoomY;
-   int count;
-   int saveX = 0;
-   int saveY;
-   BOOLEAN DesIsBiggerY=FALSE;
-
-    SrcSizeY = SourceRect->bottom - SourceRect->top;
-    SrcSizeX = SourceRect->right - SourceRect->left;
+   LONG SrcSizeY;
+   LONG SrcSizeX;
+   LONG DesSizeY;
+   LONG DesSizeX;      
+   LONG sx;
+   LONG sy;
+   LONG DesX;
+   LONG DesY;
+   LONG color;
   
-    DesSizeY = DestRect->bottom;
-    DesSizeX = DestRect->right;  
+   SrcSizeY = SourceRect->bottom - SourceRect->top;
+   SrcSizeX = SourceRect->right - SourceRect->left;
+  
+   DesSizeY = DestRect->bottom - DestRect->top;
+   DesSizeX = DestRect->right - DestRect->left;
 
-   zoomX = DesSizeX / SrcSizeX;
-   if (zoomX==0) zoomX=1;
+   switch(SourceSurf->iBitmapFormat)
+   {
+      case BMF_1BPP:
+	  /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                  sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
+                   		
+                  color = DIB_1BPP_GetPixel(SourceSurf, sx, sy);
+				  DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));                  
+            }
+       }		
 
-   zoomY = DesSizeY / SrcSizeY;
-   if (zoomY==0) zoomY=1;
+	  break;
 
-   if (DesSizeY>SrcSizeY)
-      DesIsBiggerY = TRUE;
-
-
-    switch(SourceSurf->iBitmapFormat)
-    {
-      case BMF_1BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						saveX = DesX + zoomX;
-
-						color = DIB_1BPP_GetPixel(SourceSurf, sx, sy);
-						
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-						
-					                    																	
-					  }										
-				  }
-			    }
-			 else
-			 {
-			   /* Draw one Hline on X - Led to the Des Zoom Out*/
-
-               for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						saveX = DesX + zoomX;
-
-						color = DIB_1BPP_GetPixel(SourceSurf, sx, sy);
-						
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-						
-					                    																	
-					  }										
-				  }
-			 }
-		   }			
-		   else
-		   {
-		    
-		    if (DesSizeX>SrcSizeX)
-			{
-				/* Draw one pixel on X - Led to the Des Zoom In*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color = DIB_1BPP_GetPixel(SourceSurf, sx, sy);
-						
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					                    						
-					 }
-		          }
-			 }
-			else
-			{
-				/* Draw one pixel on X - Led to the Des Zoom Out*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-					else
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color = DIB_1BPP_GetPixel(SourceSurf, sx, sy);
-						
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, DesX + zoomX, count, color);
-					                    						
-					 }
-		          }
-			}
-		   }
-		break;
-
       case BMF_4BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
+      /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;  		
+                 color = DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+                 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+            }
+       }	  	   
+      break;
 
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			    }
-			 else
-			 {
-			   /* Draw one Hline on X - Led to the Des Zoom Out*/
-
-               for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			 }
-		   }
-			
-		   else
-		   {
-		    
-		    if (DesSizeX>SrcSizeX)
-			{
-				/* Draw one pixel on X - Led to the Des Zoom In*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			 }
-			else
-			{
-				/* Draw one pixel on X - Led to the Des Zoom Out*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			}
-		   }
-		break;
-
       case BMF_8BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
+      /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;  		
+                 color = DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+                 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+            }
+       }	  	   
+      break;
 
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			    }
-			 else
-			 {
-			   /* Draw one Hline on X - Led to the Des Zoom Out*/
-
-               for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			 }
-		   }
-			
-		   else
-		   {
-		    
-		    if (DesSizeX>SrcSizeX)
-			{
-				/* Draw one pixel on X - Led to the Des Zoom In*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			 }
-			else
-			{
-				/* Draw one pixel on X - Led to the Des Zoom Out*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			}
-		   }
-		break;
-
       case BMF_16BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
+      /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;  		
+                 color = DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+                 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+            }
+       }	  	   
+      break;
 
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			    }
-			 else
-			 {
-			   /* Draw one Hline on X - Led to the Des Zoom Out*/
-
-               for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			 }
-		   }
-			
-		   else
-		   {
-		    
-		    if (DesSizeX>SrcSizeX)
-			{
-				/* Draw one pixel on X - Led to the Des Zoom In*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			 }
-			else
-			{
-				/* Draw one pixel on X - Led to the Des Zoom Out*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			}
-		   }
-		break;
-
       case BMF_24BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
+      /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;  		
+                 color = DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+                 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+            }
+       }	  	   
+      break;
 
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			    }
-			 else
-			 {
-			   /* Draw one Hline on X - Led to the Des Zoom Out*/
-
-               for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			 }
-		   }
-			
-		   else
-		   {
-		    
-		    if (DesSizeX>SrcSizeX)
-			{
-				/* Draw one pixel on X - Led to the Des Zoom In*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			 }
-			else
-			{
-				/* Draw one pixel on X - Led to the Des Zoom Out*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			}
-		   }
-		break;
-
       case BMF_32BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
+      /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                 sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;  		
+                 color = DIB_32BPP_GetPixel(SourceSurf, sx, sy);
+                 DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+            }
+       }	  	   
+      break;
 
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			    }
-			 else
-			 {
-			   /* Draw one Hline on X - Led to the Des Zoom Out*/
-
-               for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-					                    					
-						saveX = DesX + zoomX;
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
-					  }										
-				  }
-			 }
-		   }
-			
-		   else
-		   {
-		    
-		    if (DesSizeX>SrcSizeX)
-			{
-				/* Draw one pixel on X - Led to the Des Zoom In*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{						
-						sx = (int) ((ULONG) SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
-						
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			 }
-			else
-			{
-				/* Draw one pixel on X - Led to the Des Zoom Out*/
-				for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
-						sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) / ((ULONG) SrcSizeY); 
-                				
-					if (sy > SourceRect->bottom) break;
-
-					saveY = DesY+zoomY;
-
-					for (DesX=DestRect->right-zoomX; DesX>=DestRect->left; DesX-=zoomX)				
-					{
-						sx = (int) ((ULONG) DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);                 				       	            
-					
-						if (sx > SourceRect->right) break;
-					
-						color =  XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-					                    
-						for (count=DesY;count<saveY;count++)
-							DIB_1BPP_PutPixel(DestSurf, DesX, count, color);										
-					 }
-		          }
-			}
-		   }
-		break;
-
       default:
-      //DPRINT1("DIB_4BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
+      //DPRINT1("DIB_1BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat));
       return FALSE;
     }
   

Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
--- trunk/reactos/subsys/win32k/dib/dib24bpp.c	2006-01-06 02:25:12 UTC (rev 20601)
+++ trunk/reactos/subsys/win32k/dib/dib24bpp.c	2006-01-06 05:27:48 UTC (rev 20602)
@@ -497,797 +497,134 @@
                             CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
                             ULONG Mode)
 {
-   int SrcSizeY;
-   int SrcSizeX;
-   int DesSizeY;
-   int DesSizeX;      
-   int sx;
-   int sy;
-   int DesX;
-   int DesY;
-   int color;
-   int zoomX;
-   int zoomY;
-   int count;
-   int saveX;
-   int saveY;
-   BOOLEAN DesIsBiggerY=FALSE;
-
-    SrcSizeY = SourceRect->bottom - SourceRect->top;
-    SrcSizeX = SourceRect->right - SourceRect->left;
+   LONG SrcSizeY;
+   LONG SrcSizeX;
+   LONG DesSizeY;
+   LONG DesSizeX;      
+   LONG sx;
+   LONG sy;
+   LONG DesX;
+   LONG DesY;
+   LONG color;
   
-    DesSizeY = DestRect->bottom ;
-    DesSizeX = DestRect->right;  
+   SrcSizeY = SourceRect->bottom - SourceRect->top;
+   SrcSizeX = SourceRect->right - SourceRect->left;
+  
+   DesSizeY = DestRect->bottom - DestRect->top;
+   DesSizeX = DestRect->right - DestRect->left;
 
-   zoomX = DesSizeX / SrcSizeX;
-   if (zoomX==0) zoomX=1;
+   switch(SourceSurf->iBitmapFormat)
+   {
+      case BMF_1BPP:
+	  /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
+      /* This is a reference implementation, it hasn't been optimized for speed */
+                      
+       for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
+       {			 
+           sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) + SourceRect->top;
+                     
+            for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+            {			
+                  sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) + SourceRect->left;
+                   		
+                  if(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
+				  {
+					DIB_24BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
+                  } 
+				  else 
+				  {
+                    DIB_24BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 1));
+                  }
+            }
+       }		
 
-   zoomY = DesSizeY / SrcSizeY;
-   if (zoomY==0) zoomY=1;
+	  break;
 
-   if (DesSizeY>SrcSizeY)
-      DesIsBiggerY = TRUE;  
-
-    switch(SourceSurf->iBitmapFormat)
-    {
-            case BMF_1BPP:		
-  		   /* FIXME :  MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
-   		   /* This is a reference implementation, it hasn't been optimized for speed */
-           if (zoomX>1)
-		   {
-		     /* Draw one Hline on X - Led to the Des Zoom In*/
-		     if (DesSizeX>SrcSizeX)
-			 {
-		  		for (DesY=DestRect->bottom-zoomY; DesY>=DestRect->top; DesY-=zoomY)
-				{
-					if (DesIsBiggerY)
-						sy = (int) ((ULONG) SrcSizeY * (ULONG) DesY) / ((ULONG) DesSizeY);
-					else
[truncated at 1000 lines; 1773 more skipped]