implement strechblt for all 8bpp this code are not optimze.
tested with winquake 8bpp to 16/32bpp.
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for
speed */
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-05-31 13:49:41 UTC
(rev 15696)
+++ trunk/reactos/subsys/win32k/dib/dib16bpp.c 2005-05-31 14:11:02 UTC
(rev 15697)
@@ -617,21 +617,176 @@
CLIPOBJ *ClipRegion, XLATEOBJ
*ColorTranslation,
ULONG Mode)
{
+ int SrcSizeY;
+ int SrcSizeX;
+ int DesSizeY;
+ int DesSizeX;
+ int sx;
+ int sy;
+ int DesX;
+ int DesY;
+ int color;
+
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,
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
+ SrcSizeY = SourceRect->bottom;
+ SrcSizeX = SourceRect->right;
+
+ DesSizeY = DestRect->bottom;
+ DesSizeX = DestRect->right;
+
+
switch(SourceSurf->iBitmapFormat)
{
- case BMF_1BPP:
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ if(DIB_1BPP_GetPixel(SourceSurf, sx,
sy) == 0)
+ {
+ DIB_16BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
+ } else {
+ DIB_16BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, 1));
+ }
+ }
+ }
+ break;
+
case BMF_4BPP:
- 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+
+ if (sy > SourceRect->bottom) break;
+
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_16BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_16BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
case BMF_24BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_16BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
case BMF_32BPP:
- /* Not implemented yet. */
- return FALSE;
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_32BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
break;
+
case BMF_16BPP:
return ScaleRectAvg16(DestSurf, SourceSurf, DestRect,
SourceRect, MaskOrigin, BrushOrigin,
ClipRegion, ColorTranslation, Mode);
_____
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
--- trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-05-31 13:49:41 UTC
(rev 15696)
+++ trunk/reactos/subsys/win32k/dib/dib1bpp.c 2005-05-31 14:11:02 UTC
(rev 15697)
@@ -478,16 +478,208 @@
return TRUE;
}
-BOOLEAN
-DIB_1BPP_StretchBlt (
- SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
- RECTL* DestRect, RECTL *SourceRect,
- POINTL* MaskOrigin, POINTL BrushOrigin,
- CLIPOBJ *ClipRegion, XLATEOBJ *ColorTranslation,
- ULONG Mode)
+//NOTE: If you change something here, please do the same in other
dibXXbpp.c files!
+BOOLEAN DIB_1BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
+ RECTL* DestRect, RECTL *SourceRect,
+ POINTL* MaskOrigin, POINTL BrushOrigin,
+ CLIPOBJ *ClipRegion, XLATEOBJ
*ColorTranslation,
+ ULONG Mode)
{
- DbgPrint("DIB_1BPP_StretchBlt: Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
+ int SrcSizeY;
+ int SrcSizeX;
+ int DesSizeY;
+ int DesSizeX;
+ int sx;
+ int sy;
+ int DesX;
+ int DesY;
+ int color;
+
+ SrcSizeY = SourceRect->bottom;
+ SrcSizeX = SourceRect->right;
+
+ DesSizeY = DestRect->bottom;
+ DesSizeX = DestRect->right;
+
+ 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=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+
+ if (sy > SourceRect->bottom) break;
+
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_1BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf,
DesX, DesY, color);
+ }
+ }
+ break;
+
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+
+ if (sy > SourceRect->bottom) break;
+
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ case BMF_16BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ case BMF_24BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+ case BMF_32BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_32BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ default:
+ //DPRINT1("DIB_4BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
+ return FALSE;
+ }
+
+ return TRUE;
}
BOOLEAN
_____
Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
--- trunk/reactos/subsys/win32k/dib/dib24bpp.c 2005-05-31 13:49:41 UTC
(rev 15696)
+++ trunk/reactos/subsys/win32k/dib/dib24bpp.c 2005-05-31 14:11:02 UTC
(rev 15697)
@@ -302,14 +302,211 @@
return TRUE;
}
+//NOTE: If you change something here, please do the same in other
dibXXbpp.c files!
BOOLEAN DIB_24BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ
*ColorTranslation,
ULONG Mode)
{
- DbgPrint("DIB_24BPP_StretchBlt: Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
+ int SrcSizeY;
+ int SrcSizeX;
+ int DesSizeY;
+ int DesSizeX;
+ int sx;
+ int sy;
+ int DesX;
+ int DesY;
+ int color;
+
+ SrcSizeY = SourceRect->bottom;
+ SrcSizeX = SourceRect->right;
+
+ DesSizeY = DestRect->bottom;
+ DesSizeX = DestRect->right;
+
+ 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=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ 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));
+ }
+ }
+ }
+ break;
+
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+
+ if (sy > SourceRect->bottom) break;
+
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_24BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_24BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ case BMF_16BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_24BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ case BMF_24BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_24BPP_PutPixel(DestSurf,
DesX, DesY, color);
+ }
+ }
+ break;
+
+ case BMF_32BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_32BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_24BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ default:
+ //DPRINT1("DIB_24BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
+ return FALSE;
+ }
+
+ return TRUE;
}
BOOLEAN
_____
Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c
--- trunk/reactos/subsys/win32k/dib/dib32bpp.c 2005-05-31 13:49:41 UTC
(rev 15696)
+++ trunk/reactos/subsys/win32k/dib/dib32bpp.c 2005-05-31 14:11:02 UTC
(rev 15697)
@@ -79,6 +79,7 @@
switch(BltInfo->SourceSurface->iBitmapFormat)
{
case BMF_1BPP:
+
sx = BltInfo->SourcePoint.x;
sy = BltInfo->SourcePoint.y;
@@ -541,6 +542,7 @@
return TRUE;
}
+
//NOTE: If you change something here, please do the same in other
dibXXbpp.c files!
BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
@@ -548,19 +550,173 @@
CLIPOBJ *ClipRegion, XLATEOBJ
*ColorTranslation,
ULONG Mode)
{
- DPRINT("DIB_32BPP_StretchBlt: Source BPP: %u, srcRect:
(%d,%d)-(%d,%d), dstRect: (%d,%d)-(%d,%d)\n",
+
+ int SrcSizeY;
+ int SrcSizeX;
+ int DesSizeY;
+ int DesSizeX;
+ int sx;
+ int sy;
+ int DesX;
+ int DesY;
+ int color;
+
+ DPRINT("DIB_32BPP_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,
DestRect->left, DestRect->top, DestRect->right, DestRect->bottom);
+ SrcSizeY = SourceRect->bottom;
+ SrcSizeX = SourceRect->right;
+
+ DesSizeY = DestRect->bottom;
+ DesSizeX = DestRect->right;
+
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=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ if(DIB_1BPP_GetPixel(SourceSurf, sx,
sy) == 0)
+ {
+ DIB_32BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
+ } else {
+ DIB_32BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, 1));
+ }
+ }
+ }
+ break;
+
case BMF_4BPP:
- 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+
+ if (sy > SourceRect->bottom) break;
+
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_32BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_32BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
case BMF_16BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_32BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
case BMF_24BPP:
- /* Not implemented yet. */
- return FALSE;
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_32BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
break;
case BMF_32BPP:
_____
Modified: trunk/reactos/subsys/win32k/dib/dib4bpp.c
--- trunk/reactos/subsys/win32k/dib/dib4bpp.c 2005-05-31 13:49:41 UTC
(rev 15696)
+++ trunk/reactos/subsys/win32k/dib/dib4bpp.c 2005-05-31 14:11:02 UTC
(rev 15697)
@@ -356,14 +356,211 @@
return TRUE;
}
+//NOTE: If you change something here, please do the same in other
dibXXbpp.c files!
BOOLEAN DIB_4BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
RECTL* DestRect, RECTL *SourceRect,
POINTL* MaskOrigin, POINTL BrushOrigin,
CLIPOBJ *ClipRegion, XLATEOBJ
*ColorTranslation,
ULONG Mode)
{
- DbgPrint("DIB_4BPP_StretchBlt: Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
+ int SrcSizeY;
+ int SrcSizeX;
+ int DesSizeY;
+ int DesSizeX;
+ int sx;
+ int sy;
+ int DesX;
+ int DesY;
+ int color;
+
+ SrcSizeY = SourceRect->bottom;
+ SrcSizeX = SourceRect->right;
+
+ DesSizeY = DestRect->bottom;
+ DesSizeX = DestRect->right;
+
+ 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=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ if(DIB_1BPP_GetPixel(SourceSurf, sx,
sy) == 0)
+ {
+ DIB_4BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
+ } else {
+ DIB_4BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, 1));
+ }
+ }
+ }
+ break;
+
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+
+ if (sy > SourceRect->bottom) break;
+
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_4BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_4BPP_PutPixel(DestSurf,
DesX, DesY, color);
+ }
+ }
+ 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++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_8BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_4BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ case BMF_16BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_16BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_4BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
+ }
+ }
+ break;
+
+ case BMF_24BPP:
+ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode
? */
+ /* This is a reference implementation, it hasn't been
optimized for speed */
+
+ for (DesY=0; DesY<DestRect->bottom; DesY++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sy = (int) ((ULONG) SrcSizeY *
(ULONG) DesY) / ((ULONG) DesSizeY);
+ else
+ sy = (int) ((ULONG) DesSizeY * (ULONG) DesY) /
((ULONG) SrcSizeY);
+
+ if (sy > SourceRect->bottom) break;
+
+ for (DesX=0; DesX<DestRect->right;
DesX++)
+ {
+ if (DesSizeY>SrcSizeY)
+ sx = (int) ((ULONG)
SrcSizeX * (ULONG) DesX) / ((ULONG) DesSizeX);
+ else
+ sx = (int) ((ULONG)
DesSizeX * (ULONG) DesX) / ((ULONG) SrcSizeX);
+
+ if (sx > SourceRect->right)
break;
+
+ color =
DIB_24BPP_GetPixel(SourceSurf, sx, sy);
+ DIB_4BPP_PutPixel(DestSurf,
DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
[truncated at 1000 lines; 223 more skipped]