Author: gschneider
Date: Fri Jan 30 14:02:58 2009
New Revision: 39217
URL:
http://svn.reactos.org/svn/reactos?rev=39217&view=rev
Log:
Unify identical StretchBlt implementations in preparation of partial ROP suppport.
Modified:
trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Fri Jan 30 14:02:58
2009
@@ -781,13 +781,10 @@
sy_max = DesSizeY;
sy = SourceRect->top;
- switch(SourceSurf->iBitmapFormat)
- {
-
- case BMF_1BPP:
+ if (SourceSurf->iBitmapFormat != BMF_16BPP)
+ {
/* 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++)
{
sx = SourceRect->left;
@@ -796,7 +793,8 @@
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+ DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].
+ DIB_GetPixel(SourceSurf, sx, sy));
DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
@@ -817,162 +815,13 @@
sy_dec -= sy_max;
}
}
- break;
-
- case BMF_4BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_8BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
-
- case BMF_24BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_32BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_16BPP:
+ }
+ else
+ {
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;
- }
-
-
-
- return TRUE;
+ }
+ return TRUE;
}
BOOLEAN
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib1bpp.c [iso-8859-1] Fri Jan 30 14:02:58
2009
@@ -516,118 +516,21 @@
DesSizeY = DestRect->bottom - DestRect->top;
DesSizeX = DestRect->right - DestRect->left;
- 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, color));
- }
- }
-
- break;
-
- case BMF_4BPP:
- /* 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;
-
- case BMF_8BPP:
- /* 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;
-
- case BMF_16BPP:
- /* 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;
-
- case BMF_24BPP:
- /* 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;
-
- case BMF_32BPP:
- /* 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;
-
- default:
- DPRINT1("DIB_1BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
+ /* 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 = DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].
+ DIB_GetPixel(SourceSurf, sx, sy);
+ DIB_1BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation,
color));
+ }
}
-
- return TRUE;
+ return TRUE;
}
BOOLEAN
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Fri Jan 30 14:02:58
2009
@@ -459,225 +459,39 @@
sy_max = DesSizeY;
sy = SourceRect->top;
- 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+ /* 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++)
+ {
+ sx = SourceRect->left;
+ sx_dec = 0;
+
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
+ {
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].
+ DIB_GetPixel(SourceSurf, sx, sy));
+
+ DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
+
+ sx += SrcZoomXHight;
+ sx_dec += SrcZoomXLow;
+ if (sx_dec >= sx_max)
{
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_1BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
+ sx++;
+ sx_dec -= sx_max;
}
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
-
- break;
-
- case BMF_4BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_8BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_16BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_24BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_32BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
-
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- default:
- DPRINT1("DIB_24BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
+ }
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
+ }
}
-
- return TRUE;
+ return TRUE;
}
BOOLEAN
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] Fri Jan 30 14:02:58
2009
@@ -539,9 +539,8 @@
DifflDelta = DestSurf->lDelta - (DesSizeX << 2);
- switch(SourceSurf->iBitmapFormat)
+ if (SourceSurf->iBitmapFormat != BMF_32BPP)
{
- case BMF_1BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
for (DesY=0; DesY<DesSizeY; DesY++)
@@ -551,7 +550,8 @@
for (DesX=0; DesX<DesSizeX; DesX++)
{
*DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+
DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].
+ DIB_GetPixel(SourceSurf, sx, sy));
DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
@@ -574,165 +574,13 @@
sy_dec -= sy_max;
}
}
- 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<DesSizeY; DesY++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- 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<DesSizeY; DesY++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_8BPP_GetPixel(SourceSurf, sx, sy));
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- 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<DesSizeY; DesY++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- 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<DesSizeY; DesY++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
- {
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + 4);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_32BPP:
+ }
+ else
+ {
return ScaleRectAvg32(DestSurf, SourceSurf, DestRect, SourceRect, MaskOrigin,
BrushOrigin,
ClipRegion, ColorTranslation, Mode);
- break;
-
- default:
- DPRINT1("DIB_32BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
}
-
-
-
- return TRUE;
+ return TRUE;
}
BOOLEAN
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib4bpp.c [iso-8859-1] Fri Jan 30 14:02:58
2009
@@ -397,124 +397,21 @@
DesSizeY = DestRect->bottom - DestRect->top;
DesSizeX = DestRect->right - DestRect->left;
- 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_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=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_4BPP_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=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_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=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_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=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_4BPP_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=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_4BPP_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;
+ /* 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 = DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].
+ DIB_GetPixel(SourceSurf, sx, sy);
+ DIB_4BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation,
color));
+ }
+ }
+ return TRUE;
}
BOOLEAN
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] Fri Jan 30 14:02:58
2009
@@ -517,11 +517,10 @@
sy_max = DesSizeY;
sy = SourceRect->top;
- switch(SourceSurf->iBitmapFormat)
- {
- case BMF_1BPP:
- /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
- /* This is a reference implementation, it hasn't been optimized for speed */
+ if (SourceSurf->iBitmapFormat != BMF_8BPP)
+ {
+ /* 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++)
{
sx = SourceRect->left;
@@ -529,7 +528,8 @@
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+ DibFunctionsForBitmapFormat[SourceSurf->iBitmapFormat].
+ DIB_GetPixel(SourceSurf, sx, sy));
DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
@@ -550,151 +550,13 @@
sy_dec -= sy_max;
}
}
- break;
-
- case BMF_4BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_4BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_8BPP:
- return ScaleRectAvg8(DestSurf, SourceSurf, DestRect, SourceRect, MaskOrigin,
BrushOrigin,
+ }
+ else
+ {
+ return ScaleRectAvg8(DestSurf, SourceSurf, DestRect, SourceRect, MaskOrigin,
BrushOrigin,
ClipRegion, ColorTranslation, Mode);
- break;
-
- case BMF_16BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_16BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_24BPP:
- for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_24BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
- case BMF_32BPP:
- /* 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++)
- {
- sx = SourceRect->left;
- sx_dec = 0;
- for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
- {
- color = XLATEOBJ_iXlate(ColorTranslation,
- DIB_32BPP_GetPixel(SourceSurf, sx, sy));
-
- DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
-
- sx += SrcZoomXHight;
- sx_dec += SrcZoomXLow;
- if (sx_dec >= sx_max)
- {
- sx++;
- sx_dec -= sx_max;
- }
- }
-
- sy += SrcZoomYHight;
- sy_dec += SrcZoomYLow;
- if (sy_dec >= sy_max)
- {
- sy++;
- sy_dec -= sy_max;
- }
- }
- break;
-
-
-
- default:
- DPRINT1("DIB_8BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
- return FALSE;
- }
-
- return TRUE;
+ }
+ return TRUE;
}
BOOLEAN