- 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
svn path=/trunk/; revision=36997
LONG sy = 0;
LONG DesX;
LONG DesY;
- PULONG DestBits;
- LONG DifflDelta;
LONG SrcZoomXHight;
LONG SrcZoomXLow;
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,
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)
{
for (DesX=0; DesX<DesSizeX; DesX++)
{
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_1BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
+ DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
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;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
for (DesX=0; DesX<DesSizeX; DesX++)
{
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_8BPP_GetPixel(SourceSurf, sx, sy));
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_8BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 2);
+ DIB_16BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
/* 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;
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;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
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;
sx_dec -= sx_max;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
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;
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;
}
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;
}
LONG sy = 0;
LONG DesX;
LONG DesY;
- PULONG DestBits;
- LONG DifflDelta;
LONG SrcZoomXHight;
LONG SrcZoomXLow;
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);
sy_max = DesSizeY;
sy = SourceRect->top;
- DestBits = (PULONG)((PBYTE)DestSurf->pvScan0 + (DestRect->left) +
- DestRect->top * DestSurf->lDelta);
-
- DifflDelta = DestSurf->lDelta - DesSizeX ;
-
switch(SourceSurf->iBitmapFormat)
{
case BMF_1BPP:
sx_dec = 0;
for (DesX=0; DesX<DesSizeX; DesX++)
{
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_1BPP_GetPixel(SourceSurf, sx, sy));
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_1BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+ DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
sx_dec = 0;
for (DesX=0; DesX<DesSizeX; DesX++)
{
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_4BPP_GetPixel(SourceSurf, sx, sy));
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_4BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+ DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
sx_dec = 0;
for (DesX=0; DesX<DesSizeX; DesX++)
{
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_16BPP_GetPixel(SourceSurf, sx, sy));
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_16BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+ DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
sx_dec = 0;
for (DesX=0; DesX<DesSizeX; DesX++)
{
- *DestBits = XLATEOBJ_iXlate(ColorTranslation,
- DIB_24BPP_GetPixel(SourceSurf, sx, sy));
+ color = XLATEOBJ_iXlate(ColorTranslation,
+ DIB_24BPP_GetPixel(SourceSurf, sx, sy));
- DestBits = (PULONG)((ULONG_PTR)DestBits + 1);
+ DIB_8BPP_PutPixel(DestSurf, DesX, DesY, color);
sx += SrcZoomXHight;
sx_dec += SrcZoomXLow;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)
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;
}
}
- DestBits = (PULONG)((ULONG_PTR)DestBits + DifflDelta);
-
sy += SrcZoomYHight;
sy_dec += SrcZoomYLow;
if (sy_dec >= sy_max)