Author: gschneider Date: Sun Oct 26 13:07:10 2008 New Revision: 36997
URL: http://svn.reactos.org/svn/reactos?rev=36997&view=rev Log: StretchBlt: - Pixel size depends on the type of the destination surface, so don't always write ULONG values - Use PutPixel and remove now unneeded position code - Fixes high red zone overwrites, see bug #812 (vlc) and bug #3807 (ccleaner) - Enable dprints for unhandled sources - Add a parameter dprint for 24bpp
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.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/dib... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib16bpp.c [iso-8859-1] Sun Oct 26 13:07:10 2008 @@ -740,8 +740,6 @@ LONG sy = 0; LONG DesX; LONG DesY; - PULONG DestBits; - LONG DifflDelta;
LONG SrcZoomXHight; LONG SrcZoomXLow; @@ -753,6 +751,7 @@
LONG sx_dec = 0; LONG sx_max; + ULONG 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, @@ -781,11 +780,6 @@ sx_max = DesSizeX; sy_max = DesSizeY; sy = SourceRect->top; - - DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) + - DestRect->top * DestSurf->lDelta); - - DifflDelta = DestSurf->lDelta - (DesSizeX << 1);
switch(SourceSurf->iBitmapFormat) { @@ -801,10 +795,10 @@
for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, - DIB_1BPP_GetPixel(SourceSurf, sx, sy)); - - DestBits = (PULONG)((ULONG_PTR)DestBits + 2); + color = XLATEOBJ_iXlate(ColorTranslation, + DIB_1BPP_GetPixel(SourceSurf, sx, sy)); + + DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -815,8 +809,6 @@ } }
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta); - sy += SrcZoomYHight; sy_dec += SrcZoomYLow; if (sy_dec >= sy_max) @@ -838,10 +830,10 @@
for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, + color = XLATEOBJ_iXlate(ColorTranslation, DIB_4BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2); + DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -852,8 +844,6 @@ } }
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta); - sy += SrcZoomYHight; sy_dec += SrcZoomYLow; if (sy_dec >= sy_max) @@ -875,10 +865,10 @@
for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, - DIB_8BPP_GetPixel(SourceSurf, sx, sy)); - - DestBits = (PULONG)((ULONG_PTR)DestBits + 2); + color = XLATEOBJ_iXlate(ColorTranslation, + DIB_8BPP_GetPixel(SourceSurf, sx, sy)); + + DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -889,8 +879,6 @@ } }
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta); - sy += SrcZoomYHight; sy_dec += SrcZoomYLow; if (sy_dec >= sy_max) @@ -906,11 +894,6 @@ /* FIXME : MaskOrigin, BrushOrigin, ClipRegion, Mode ? */ /* This is a reference implementation, it hasn't been optimized for speed */
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left << 1) + - DestRect->top * DestSurf->lDelta); - - DifflDelta = DestSurf->lDelta - (DesSizeX << 1); - for (DesY=0; DesY<DesSizeY; DesY++) { sx = SourceRect->left; @@ -918,10 +901,10 @@
for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, + color = XLATEOBJ_iXlate(ColorTranslation, DIB_24BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2); + DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -932,8 +915,6 @@ } }
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta); - sy += SrcZoomYHight; sy_dec += SrcZoomYLow; if (sy_dec >= sy_max) @@ -955,10 +936,10 @@
for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, + color = XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2); + DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -968,7 +949,6 @@ sx_dec -= sx_max; } } - DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight; sy_dec += SrcZoomYLow;
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/dib... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib24bpp.c [iso-8859-1] Sun Oct 26 13:07:10 2008 @@ -420,6 +420,9 @@ LONG DesY; LONG 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;
@@ -539,7 +542,7 @@ break;
default: - //DPRINT1("DIB_24BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat)); + DPRINT1("DIB_24BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat)); return FALSE; }
Modified: trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/dib... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib32bpp.c [iso-8859-1] Sun Oct 26 13:07:10 2008 @@ -726,7 +726,7 @@ break;
default: - //DPRINT1("DIB_32BPP_StretchBlt: Unhandled Source BPP: %u\n", BitsPerFormat(SourceSurf->iBitmapFormat)); + DPRINT1("DIB_32BPP_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/dib... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/dib/dib8bpp.c [iso-8859-1] Sun Oct 26 13:07:10 2008 @@ -475,8 +475,6 @@ LONG sy = 0; LONG DesX; LONG DesY; - PULONG DestBits; - LONG DifflDelta;
LONG SrcZoomXHight; LONG SrcZoomXLow; @@ -489,6 +487,8 @@ LONG sx_dec = 0; LONG sx_max;
+ ULONG color; + DPRINT("DIB_8BPP_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); @@ -516,11 +516,6 @@ sx_max = DesSizeX; sy_max = DesSizeY; sy = SourceRect->top; - - DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left) + - DestRect->top * DestSurf->lDelta); - - DifflDelta = DestSurf->lDelta - DesSizeX ;
switch(SourceSurf->iBitmapFormat) { @@ -533,10 +528,10 @@ sx_dec = 0; for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, - DIB_1BPP_GetPixel(SourceSurf, sx, sy)); - - DestBits = (PULONG)((ULONG_PTR)DestBits + 1); + color = XLATEOBJ_iXlate(ColorTranslation, + DIB_1BPP_GetPixel(SourceSurf, sx, sy)); + + DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -546,8 +541,6 @@ sx_dec -= sx_max; } } - - DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight; sy_dec += SrcZoomYLow; @@ -568,10 +561,10 @@ sx_dec = 0; for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, - DIB_4BPP_GetPixel(SourceSurf, sx, sy)); - - DestBits = (PULONG)((ULONG_PTR)DestBits + 1); + color = XLATEOBJ_iXlate(ColorTranslation, + DIB_4BPP_GetPixel(SourceSurf, sx, sy)); + + DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -581,8 +574,6 @@ sx_dec -= sx_max; } } - - DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight; sy_dec += SrcZoomYLow; @@ -608,10 +599,10 @@ sx_dec = 0; for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, - DIB_16BPP_GetPixel(SourceSurf, sx, sy)); - - DestBits = (PULONG)((ULONG_PTR)DestBits + 1); + color = XLATEOBJ_iXlate(ColorTranslation, + DIB_16BPP_GetPixel(SourceSurf, sx, sy)); + + DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -621,8 +612,6 @@ sx_dec -= sx_max; } } - - DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight; sy_dec += SrcZoomYLow; @@ -641,10 +630,10 @@ sx_dec = 0; for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, - DIB_24BPP_GetPixel(SourceSurf, sx, sy)); - - DestBits = (PULONG)((ULONG_PTR)DestBits + 1); + color = XLATEOBJ_iXlate(ColorTranslation, + DIB_24BPP_GetPixel(SourceSurf, sx, sy)); + + DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -654,8 +643,6 @@ sx_dec -= sx_max; } } - - DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight; sy_dec += SrcZoomYLow; @@ -676,10 +663,10 @@ sx_dec = 0; for (DesX=0; DesX<DesSizeX; DesX++) { - *DestBits = XLATEOBJ_iXlate(ColorTranslation, + color = XLATEOBJ_iXlate(ColorTranslation, DIB_32BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 1); + DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight; sx_dec += SrcZoomXLow; @@ -689,8 +676,6 @@ sx_dec -= sx_max; } } - - DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight; sy_dec += SrcZoomYLow;