Author: gschneider
Date: Mon Nov 3 06:40:24 2008
New Revision: 37168
URL:
http://svn.reactos.org/svn/reactos?rev=37168&view=rev
Log:
StretchBlt:
- Enable unsupported bit depth dprint (4bpp)
- Respect the destination offset instead of always starting the blt at 0,0 (8/16bpp)
- Adapt routine from 8/16/32bpp, tested to be approx 15-25% faster than the old one
(24bpp)
Modified:
trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c
trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.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] Mon Nov 3 06:40:24
2008
@@ -788,12 +788,12 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_1BPP_GetPixel(SourceSurf, sx, sy));
@@ -823,12 +823,12 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_4BPP_GetPixel(SourceSurf, sx, sy));
@@ -858,12 +858,12 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_8BPP_GetPixel(SourceSurf, sx, sy));
@@ -894,12 +894,12 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_24BPP_GetPixel(SourceSurf, sx, sy));
@@ -929,12 +929,12 @@
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_32BPP_GetPixel(SourceSurf, sx, sy));
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] Mon Nov 3 06:40:24
2008
@@ -414,20 +414,50 @@
LONG SrcSizeX;
LONG DesSizeY;
LONG DesSizeX;
- LONG sx;
- LONG sy;
+ LONG sx = 0;
+ LONG sy = 0;
LONG DesX;
LONG DesY;
- LONG color;
+
+ LONG SrcZoomXHight;
+ LONG SrcZoomXLow;
+ LONG SrcZoomYHight;
+ LONG SrcZoomYLow;
+
+ LONG sy_dec = 0;
+ LONG sy_max;
+
+ LONG sx_dec = 0;
+ LONG sx_max;
+ ULONG color;
DPRINT("DIB_24BPP_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 - SourceRect->top;
- SrcSizeX = SourceRect->right - SourceRect->left;
-
- DesSizeY = DestRect->bottom - DestRect->top;
- DesSizeX = DestRect->right - DestRect->left;
+
+ /* Calc the Zoom height of Source */
+ SrcSizeY = SourceRect->bottom - SourceRect->top;
+
+ /* Calc the Zoom Width of Source */
+ SrcSizeX = SourceRect->right - SourceRect->left;
+
+ /* Calc the Zoom height of Destinations */
+ DesSizeY = DestRect->bottom - DestRect->top;
+
+ /* Calc the Zoom width of Destinations */
+ DesSizeX = DestRect->right - DestRect->left;
+
+ /* Calc the zoom factor of source height */
+ SrcZoomYHight = SrcSizeY / DesSizeY;
+ SrcZoomYLow = SrcSizeY - (SrcZoomYHight * DesSizeY);
+
+ /* Calc the zoom factor of source width */
+ SrcZoomXHight = SrcSizeX / DesSizeX;
+ SrcZoomXLow = SrcSizeX - (SrcZoomXHight * DesSizeX);
+
+ sx_max = DesSizeX;
+ sy_max = DesSizeY;
+ sy = SourceRect->top;
switch(SourceSurf->iBitmapFormat)
{
@@ -437,20 +467,31 @@
for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
+ sx = SourceRect->left;
+ sx_dec = 0;
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));
- }
+ 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;
+ }
+ }
+
+ sy += SrcZoomYHight;
+ sy_dec += SrcZoomYLow;
+ if (sy_dec >= sy_max)
+ {
+ sy++;
+ sy_dec -= sy_max;
}
}
@@ -462,13 +503,31 @@
for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
+ sx = SourceRect->left;
+ sx_dec = 0;
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_4BPP_GetPixel(SourceSurf, sx, sy);
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ 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;
@@ -479,13 +538,31 @@
for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
+ sx = SourceRect->left;
+ sx_dec = 0;
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_8BPP_GetPixel(SourceSurf, sx, sy);
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ 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;
@@ -496,13 +573,31 @@
for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
+ sx = SourceRect->left;
+ sx_dec = 0;
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_16BPP_GetPixel(SourceSurf, sx, sy);
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ 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;
@@ -513,13 +608,31 @@
for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
+ sx = SourceRect->left;
+ sx_dec = 0;
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_24BPP_GetPixel(SourceSurf, sx, sy);
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ 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;
@@ -530,13 +643,31 @@
for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
- sy = (((DesY - DestRect->top) * SrcSizeY) / DesSizeY) +
SourceRect->top;
+ sx = SourceRect->left;
+ sx_dec = 0;
for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
- sx = (((DesX - DestRect->left) * SrcSizeX) / DesSizeX) +
SourceRect->left;
- color = DIB_32BPP_GetPixel(SourceSurf, sx, sy);
- DIB_24BPP_PutPixel(DestSurf, DesX, DesY,
XLATEOBJ_iXlate(ColorTranslation, color));
+ 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;
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] Mon Nov 3 06:40:24
2008
@@ -510,7 +510,7 @@
break;
default:
- //DPRINT1("DIB_4BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
+ DPRINT1("DIB_4BPP_StretchBlt: Unhandled Source BPP: %u\n",
BitsPerFormat(SourceSurf->iBitmapFormat));
return FALSE;
}
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] Mon Nov 3 06:40:24
2008
@@ -522,11 +522,11 @@
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++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_1BPP_GetPixel(SourceSurf, sx, sy));
@@ -555,11 +555,11 @@
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++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_4BPP_GetPixel(SourceSurf, sx, sy));
@@ -593,11 +593,11 @@
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++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_16BPP_GetPixel(SourceSurf, sx, sy));
@@ -624,11 +624,11 @@
break;
case BMF_24BPP:
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_24BPP_GetPixel(SourceSurf, sx, sy));
@@ -657,11 +657,11 @@
case BMF_32BPP:
/* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */
/* This is a reference implementation, it hasn't been optimized for speed */
- for (DesY=0; DesY<DesSizeY; DesY++)
+ for (DesY=DestRect->top; DesY<DestRect->bottom; DesY++)
{
sx = SourceRect->left;
sx_dec = 0;
- for (DesX=0; DesX<DesSizeX; DesX++)
+ for (DesX=DestRect->left; DesX<DestRect->right; DesX++)
{
color = XLATEOBJ_iXlate(ColorTranslation,
DIB_32BPP_GetPixel(SourceSurf, sx, sy));