small optimze for StretchBlt
Thanks Alex for the idea with neg for statement
it is still a ref implemnet and have some limits
Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib4bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c
_____
Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c
--- trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-06-01 17:28:51 UTC
(rev 15715)
+++ trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-06-01 18:11:26 UTC
(rev 15716)
@@ -629,6 +629,9 @@
int zoomX;
int zoomY;
int count;
+ int saveX;
+ int saveY;
+ BOOLEAN DesIsBiggerY=FALSE;
DPRINT("DIB_16BPP_StretchBlt: Source BPP: %u, srcRect:
(%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
BitsPerFormat(SourceSurf->iBitmapFormat), SourceRect->left,
SourceRect->top, SourceRect->right, SourceRect->bottom,
@@ -646,202 +649,656 @@
zoomY = DesSizeY / SrcSizeY;
if (zoomY==0) zoomY=1;
+ if (DesSizeY>SrcSizeY)
+ DesIsBiggerY = TRUE;
+
+
+
switch(SourceSurf->iBitmapFormat)
{
- case BMF_1BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+
+
+ 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>=0; 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;
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
- {
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ saveY = DesY+zoomY;
- if (sy > SourceRect->bottom) break;
+ for (DesX=DestRect->right-zoomX;
DesX>=0; DesX-=zoomX)
+ {
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+
+ if (sx >
SourceRect->right) break;
+
+ saveX = DesX + zoomX;
- for (DesX=0; DesX<DestRect->right;
DesX+=zoomX)
+ if
(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_HLine(DestSurf, DesX, saveX, count, 0);
+ else
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_HLine(DestSurf, DesX, saveX, count, 1);
+
+ }
+ }
+ }
+ else
+ {
+ /* Draw one Hline on X - Led to the Des Zoom
Out*/
+
+ for (DesY=DestRect->bottom-zoomY; DesY>=0; DesY-=zoomY)
{
- if (DesSizeX>SrcSizeX)
- sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ 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>=0; DesX-=zoomX)
+ {
sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
- if (sx > SourceRect->right)
break;
+ if (sx >
SourceRect->right) break;
+
+ saveX = DesX + zoomX;
- if(DIB_1BPP_GetPixel(SourceSurf,
sx, sy) == 0)
+ if
(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_HLine(DestSurf, DesX, saveX, count, 0);
+ else
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_HLine(DestSurf, DesX, saveX, count, 1);
+
+ }
+ }
+ }
+ }
+ else
+ {
+
+ if (DesSizeX>SrcSizeX)
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom In*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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>=0; DesX-=zoomX)
+ {
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+
+ if (sx >
SourceRect->right) break;
+
+ if
(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, 0);
+ else
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, 1);
+
+
+ }
+ }
+ }
+ else
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom Out*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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>=0; DesX-=zoomX)
{
- for
(count=DesY;count<DesY+zoomY;count++)
- {
- if (zoomX>1)
-
DIB_16BPP_HLine(DestSurf, DesX, DesX + zoomX, count,
XLATEOBJ_iXlate(ColorTranslation, 0));
- else
-
DIB_16BPP_PutPixel(DestSurf, DesX, count,
XLATEOBJ_iXlate(ColorTranslation, 0));
- }
-
- } else {
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx >
SourceRect->right) break;
+
+ if
(DIB_1BPP_GetPixel(SourceSurf, sx, sy) == 0)
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, 0);
+ else
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, 1);
+
+ }
+ }
+ }
+ }
+ break;
- for
(count=DesY;count<DesY+zoomY;count++)
- {
- if (zoomX>1)
-
DIB_16BPP_HLine(DestSurf, DesX, DesX + zoomX, count,
XLATEOBJ_iXlate(ColorTranslation, 1));
- else
-
DIB_16BPP_PutPixel(DestSurf, DesX, count,
XLATEOBJ_iXlate(ColorTranslation, 1));
- }
- }
- }
- }
- break;
-
- case BMF_4BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ case BMF_4BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
/* This is a reference implementation, it hasn't been
optimized for speed */
-
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
- {
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ if (zoomX>1)
+ {
+ /* Draw one Hline on X - Led to the Des Zoom In*/
+ if (DesSizeX>SrcSizeX)
+ {
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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;
- if (sy > SourceRect->bottom) break;
+ saveY = DesY+zoomY;
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_HLine(DestSurf, DesX, saveX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one Hline on X - Led to the Des Zoom
Out*/
- for (DesX=0; DesX<DestRect->right;
DesX+=zoomX)
+ for (DesY=DestRect->bottom-zoomY; DesY>=0; DesY-=zoomY)
{
- if (DesSizeX>SrcSizeX)
- sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ 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>=0; DesX-=zoomX)
+ {
sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
- if (sx > SourceRect->right)
break;
+ 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_16BPP_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>=0; 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;
- color =
DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ saveY = DesY+zoomY;
+
+ for (DesX=DestRect->right-zoomX;
DesX>=0; DesX-=zoomX)
+ {
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+
+ if (sx >
SourceRect->right) break;
- for
(count=DesY;count<DesY+zoomY;count++)
+ color =
XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx,
sy));
+
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom Out*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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>=0; DesX-=zoomX)
{
- if (zoomX>1)
-
DIB_16BPP_HLine(DestSurf, DesX, DesX + zoomX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- else
-
DIB_16BPP_PutPixel(DestSurf, DesX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- }
+ 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_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ }
+ break;
- }
- }
- break;
-
case BMF_8BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
/* This is a reference implementation, it hasn't been
optimized for speed */
-
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
- {
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ if (zoomX>1)
+ {
+ /* Draw one Hline on X - Led to the Des Zoom In*/
+ if (DesSizeX>SrcSizeX)
+ {
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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;
+ if (sy > SourceRect->bottom)
break;
- for (DesX=0; DesX<DestRect->right;
DesX+=zoomX)
+ saveY = DesY+zoomY;
+
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_HLine(DestSurf, DesX, saveX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one Hline on X - Led to the Des Zoom
Out*/
+
+ for (DesY=DestRect->bottom-zoomY; DesY>=0; DesY-=zoomY)
{
- if (DesSizeX>SrcSizeX)
- sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ 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>=0; DesX-=zoomX)
+ {
sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
- if (sx > SourceRect->right)
break;
+ 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_16BPP_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>=0; 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;
- color =
DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ saveY = DesY+zoomY;
- for
(count=DesY;count<DesY+zoomY;count++)
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom Out*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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>=0; DesX-=zoomX)
{
- if (zoomX>1)
-
DIB_16BPP_HLine(DestSurf, DesX, DesX + zoomX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- else
-
DIB_16BPP_PutPixel(DestSurf, DesX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- }
-
- }
- }
+ 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_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ }
break;
- case BMF_24BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ case BMF_16BPP:
+ return ScaleRectAvg16(DestSurf, SourceSurf, DestRect,
SourceRect, MaskOrigin, BrushOrigin,
+ ClipRegion, ColorTranslation, Mode);
+ 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>=0; 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;
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
+ saveY = DesY+zoomY;
+
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_HLine(DestSurf, DesX, saveX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one Hline on X - Led to the Des Zoom
Out*/
+
+ for (DesY=DestRect->bottom-zoomY; DesY>=0; 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>=0; 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_16BPP_HLine(DestSurf, DesX, saveX, count, color);
+ }
+ }
+ }
+ }
+
+ else
+ {
+
+ if (DesSizeX>SrcSizeX)
{
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ /* Draw one pixel on X - Led to the Des
Zoom In*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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;
+ if (sy > SourceRect->bottom)
break;
- for (DesX=0; DesX<DestRect->right;
DesX+=zoomX)
+ saveY = DesY+zoomY;
+
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom Out*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; DesY-=zoomY)
{
- if (DesSizeX>SrcSizeX)
- sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ 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>=0; DesX-=zoomX)
+ {
sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
- if (sx > SourceRect->right)
break;
+ if (sx >
SourceRect->right) break;
+
+ color =
XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx,
sy));
+
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ }
+ break;
- color =
DIB_24BPP_GetPixel(SourceSurf, sx, sy);
- for
(count=DesY;count<DesY+zoomY;count++)
- {
- if (zoomX>1)
-
DIB_16BPP_HLine(DestSurf, DesX, DesX + zoomX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- else
-
DIB_16BPP_PutPixel(DestSurf, DesX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- }
- }
- }
- break;
-
- case BMF_32BPP:
+ 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>=0; 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;
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
+ saveY = DesY+zoomY;
+
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_HLine(DestSurf, DesX, saveX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one Hline on X - Led to the Des Zoom
Out*/
+
+ for (DesY=DestRect->bottom-zoomY; DesY>=0; 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>=0; 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_16BPP_HLine(DestSurf, DesX, saveX, count, color);
+ }
+ }
+ }
+ }
+
+ else
+ {
+
+ if (DesSizeX>SrcSizeX)
{
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ /* Draw one pixel on X - Led to the Des
Zoom In*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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;
+ if (sy > SourceRect->bottom)
break;
- for (DesX=0; DesX<DestRect->right;
DesX+=zoomX)
+ saveY = DesY+zoomY;
+
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ else
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom Out*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; DesY-=zoomY)
{
- if (DesSizeX>SrcSizeX)
- sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ 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>=0; DesX-=zoomX)
+ {
sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
- if (sx > SourceRect->right)
break;
+ if (sx >
SourceRect->right) break;
+
+ color =
XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx,
sy));
+
+ for
(count=DesY;count<saveY;count++)
+
DIB_16BPP_PutPixel(DestSurf, DesX, count, color);
+ }
+ }
+ }
+ }
+ break;
- color =
DIB_32BPP_GetPixel(SourceSurf, sx, sy);
- for
(count=DesY;count<DesY+zoomY;count++)
- {
- if (zoomX>1)
-
DIB_16BPP_HLine(DestSurf, DesX, DesX + zoomX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- else
-
DIB_16BPP_PutPixel(DestSurf, DesX, count,
XLATEOBJ_iXlate(ColorTranslation, color));
- }
- }
- }
break;
-
- case BMF_16BPP:
- return ScaleRectAvg16(DestSurf, SourceSurf, DestRect,
SourceRect, MaskOrigin, BrushOrigin,
- ClipRegion, ColorTranslation, Mode);
- break;
-
default:
DPRINT1("DIB_16BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
return FALSE;
_____
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
--- trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-06-01 17:28:51 UTC
(rev 15715)
+++ trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-06-01 18:11:26 UTC
(rev 15716)
@@ -497,6 +497,9 @@
int zoomX;
int zoomY;
int count;
+ int saveX;
+ int saveY;
+ BOOLEAN DesIsBiggerY=FALSE;
SrcSizeY = SourceRect->bottom;
SrcSizeX = SourceRect->right;
@@ -510,225 +513,762 @@
zoomY = DesSizeY / SrcSizeY;
if (zoomY==0) zoomY=1;
+ if (DesSizeY>SrcSizeY)
+ DesIsBiggerY = TRUE;
+
switch(SourceSurf->iBitmapFormat)
{
- case BMF_1BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ case BMF_1BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
/* This is a reference implementation, it hasn't been
optimized for speed */
-
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
- {
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ if (zoomX>1)
+ {
+ /* Draw one Hline on X - Led to the Des Zoom In*/
+ if (DesSizeX>SrcSizeX)
+ {
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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;
- if (sy > SourceRect->bottom) break;
+ saveY = DesY+zoomY;
+ for (DesX=DestRect->right-zoomX;
DesX>=0; DesX-=zoomX)
+ {
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+
+ if (sx >
SourceRect->right) break;
+
+ saveX = DesX + zoomX;
- for (DesX=0; DesX<DestRect->right;
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>=0; DesY-=zoomY)
{
- if (DesSizeX>SrcSizeX)
- sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ 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>=0; DesX-=zoomX)
+ {
sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
- if (sx > SourceRect->right)
break;
-
- color =
DIB_1BPP_GetPixel(SourceSurf, sx, sy);
+ if (sx >
SourceRect->right) break;
- for
(count=DesY;count<DesY+zoomY;count++)
- {
- if (zoomX>1)
-
DIB_1BPP_HLine(DestSurf, DesX, DesX + zoomX, count, color);
- else
-
DIB_1BPP_PutPixel(DestSurf, DesX, count, color);
- }
+ saveX = DesX + zoomX;
+ color =
DIB_1BPP_GetPixel(SourceSurf, sx, sy);
+
+ for
(count=DesY;count<saveY;count++)
+
DIB_1BPP_HLine(DestSurf, DesX, saveX, count, color);
+
+
+ }
}
- }
- break;
+ }
+ }
+ else
+ {
+
+ if (DesSizeX>SrcSizeX)
+ {
+ /* Draw one pixel on X - Led to the Des
Zoom In*/
+ for (DesY=DestRect->bottom-zoomY;
DesY>=0; 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;
- case BMF_4BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
- /* This is a reference implementation, it hasn't been
optimized for speed */
+ saveY = DesY+zoomY;
- for (DesY=0; DesY<DestRect->bottom; DesY+=zoomY)
- {
- if (DesSizeY>SrcSizeY)
- sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
- else
- sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+ for (DesX=DestRect->right-zoomX;
DesX>=0; 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>=0; 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;
- if (sy > SourceRect->bottom) break;
+ saveY = DesY+zoomY;
+ for (DesX=DestRect->right-zoomX;
DesX>=0; DesX-=zoomX)
+ {
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ 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);
+
+ }
+ }
+ }
+ }
+ break;
- for (DesX=0; DesX<DestRect->right;
DesX+=zoomX)
+ case BMF_4BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+ if (zoomX>1)
+ {
[truncated at 1000 lines; 4182 more skipped]