mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
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 */ svn path=/trunk/; revision=15697
This commit is contained in:
parent
48af34a807
commit
e79b3bf80c
6 changed files with 1073 additions and 28 deletions
|
@ -617,21 +617,176 @@ BOOLEAN DIB_16BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
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_4BPP:
|
||||
case BMF_8BPP:
|
||||
case BMF_24BPP:
|
||||
case BMF_32BPP:
|
||||
/* Not implemented yet. */
|
||||
return FALSE;
|
||||
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:
|
||||
/* 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:
|
||||
/* 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);
|
||||
|
|
|
@ -478,16 +478,208 @@ DIB_1BPP_BitBlt(PBLTINFO BltInfo)
|
|||
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
|
||||
|
|
|
@ -302,14 +302,211 @@ DIB_24BPP_BitBlt(PBLTINFO BltInfo)
|
|||
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
|
||||
|
|
|
@ -79,6 +79,7 @@ DIB_32BPP_BitBltSrcCopy(PBLTINFO BltInfo)
|
|||
switch(BltInfo->SourceSurface->iBitmapFormat)
|
||||
{
|
||||
case BMF_1BPP:
|
||||
|
||||
sx = BltInfo->SourcePoint.x;
|
||||
sy = BltInfo->SourcePoint.y;
|
||||
|
||||
|
@ -541,6 +542,7 @@ BOOLEAN ScaleRectAvg32(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
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 @@ BOOLEAN DIB_32BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
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:
|
||||
/* 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:
|
||||
|
|
|
@ -356,14 +356,211 @@ DIB_4BPP_BitBlt(PBLTINFO BltInfo)
|
|||
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));
|
||||
}
|
||||
}
|
||||
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_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;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -534,25 +534,173 @@ BOOLEAN ScaleRectAvg8(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
//NOTE: If you change something here, please do the same in other dibXXbpp.c files!
|
||||
BOOLEAN DIB_8BPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
|
||||
RECTL* DestRect, RECTL *SourceRect,
|
||||
POINTL* MaskOrigin, POINTL BrushOrigin,
|
||||
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_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);
|
||||
|
||||
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_8BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, 0));
|
||||
} else {
|
||||
DIB_8BPP_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_8BPP_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_8BPP_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_8BPP_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_32BPP_GetPixel(SourceSurf, sx, sy);
|
||||
DIB_8BPP_PutPixel(DestSurf, DesX, DesY, XLATEOBJ_iXlate(ColorTranslation, color));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BMF_8BPP:
|
||||
|
|
Loading…
Reference in a new issue