More bitmap format translation bugs

svn path=/trunk/; revision=5951
This commit is contained in:
Gé van Geldorp 2003-08-31 10:20:33 +00:00
parent f62b36b0f1
commit cbd7a663c8
2 changed files with 51 additions and 20 deletions

View file

@ -42,18 +42,12 @@ BOOL
DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
RECTL *DestRect, POINTL *SourcePoint)
{
LONG i, j, dx, dy, alterx, altery, idxColor, RGBulong = 0, c8;
BYTE *GDIpos, *initial, *tMask, *lMask;
GDIpos = Source->pvScan0;
LONG dx, dy;
dx = DestRect->right - DestRect->left;
dy = DestRect->bottom - DestRect->top;
alterx = abs(SourcePoint->x - DestRect->left);
altery = abs(SourcePoint->y - DestRect->top);
if (NULL == ColorTranslation)
if (NULL == ColorTranslation || 0 != (ColorTranslation->flXlate & XO_TRIVIAL))
{
DIB_BltToVGA(DestRect->left, DestRect->top, dx, dy,
Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1),
@ -62,18 +56,9 @@ DIBtoVGA(SURFOBJ *Dest, SURFOBJ *Source, XLATEOBJ *ColorTranslation,
else
{
/* Perform color translation */
for (j = SourcePoint->y; j < SourcePoint->y+dy; j++)
{
initial = GDIpos;
for (i=SourcePoint->x; i<SourcePoint->x+dx; i++)
{
idxColor = XLATEOBJ_iXlate(ColorTranslation, *GDIpos);
vgaPutPixel(i+alterx, j+altery, idxColor);
GDIpos+=1;
}
GDIpos = initial + Source->lDelta;
}
DIB_BltToVGAWithXlate(DestRect->left, DestRect->top, dx, dy,
Source->pvScan0 + SourcePoint->y * Source->lDelta + (SourcePoint->x >> 1),
Source->lDelta, ColorTranslation);
}
}

View file

@ -573,6 +573,52 @@ void DIB_BltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta)
}
}
/* DIB blt to the VGA. */
void DIB_BltToVGAWithXlate(int x, int y, int w, int h, void *b, int Source_lDelta, PXLATEOBJ Xlate)
{
PBYTE pb, opb = b;
ULONG i, j;
ULONG x2 = x + w;
ULONG y2 = y + h;
ULONG offset;
UCHAR a;
for (i = x; i < x2; i++)
{
pb = opb;
offset = xconv[i] + y80[y];
WRITE_PORT_UCHAR((PUCHAR)GRA_I, 0x08); // set the mask
WRITE_PORT_UCHAR((PUCHAR)GRA_D, maskbit[i]);
if (0 == ((i - x) % 2))
{
for (j = y; j < y2; j++)
{
a = READ_REGISTER_UCHAR(vidmem + offset);
WRITE_REGISTER_UCHAR(vidmem + offset, XLATEOBJ_iXlate(Xlate, (*pb & 0xf0) >> 4));
offset += 80;
pb += Source_lDelta;
}
}
else
{
for (j = y; j < y2; j++)
{
a = READ_REGISTER_UCHAR(vidmem + offset);
WRITE_REGISTER_UCHAR(vidmem + offset, XLATEOBJ_iXlate(Xlate, *pb & 0x0f));
offset += 80;
pb += Source_lDelta;
}
}
if (0 != ((i - x) % 2))
{
opb++;
}
}
}
void DIB_TransparentBltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta, ULONG trans)
// DIB blt to the VGA.