Skip to content

Commit

Permalink
FULLPIPE: Fixed to RB bitmap rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 6, 2013
1 parent ba93c8d commit 4554ac2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 40 deletions.
70 changes: 35 additions & 35 deletions engines/fullpipe/gfx.cpp
Expand Up @@ -318,12 +318,6 @@ void Picture::draw(int x, int y, int style, int angle) {
warning("Picture:draw: alpha = %0x", _alpha);
}

if (_bitmap->_type == MKTAG('C', 'B', '\0', '\0') || _bitmap->_type == MKTAG('R', 'B', '\0', '\0')) {
if (_paletteData) {
warning("Picture:draw: have palette");
}
}

switch (style) {
case 1:
//flip
Expand All @@ -337,7 +331,7 @@ void Picture::draw(int x, int y, int style, int angle) {
warning("Picture:draw: angle = %d", angle);
drawRotated(x1, y1, angle);
} else {
_bitmap->putDib(x1, y1, _paletteData);
_bitmap->putDib(x1, y1, (int32 *)_paletteData);
}
}
}
Expand All @@ -349,7 +343,7 @@ void Picture::displayPicture() {
if (g_fullpipe->_needQuit)
return;

if (0 && !Common::String(_memfilename).hasSuffix(".dib"))
if (Common::String(_memfilename).hasSuffix(".dib"))
return;

getData();
Expand All @@ -372,20 +366,20 @@ void Picture::displayPicture() {
}
}

void Bitmap::putDib(int x, int y, byte *palette) {
int16 *curDestPtr;
void Bitmap::putDib(int x, int y, int32 *palette) {
uint16 *curDestPtr;
int endy;
int pos;
byte *srcPtr;
uint pixel;
int start1;
int fillValue;
int pixoffset;
int end2;
int pixelHigh;
int pixoffset1;
int leftx;
uint pixel1;
uint16 pixel;
uint16 pixel1;
uint pixel1High;
int bpp;
uint pitch;
Expand Down Expand Up @@ -419,48 +413,55 @@ void Bitmap::putDib(int x, int y, byte *palette) {
while (1) {
while (1) {
while (1) {
pixel = *(int16 *)srcPtr;
pixel = *(uint16 *)srcPtr;
srcPtr += 2;
pixPtr = srcPtr;
if (pixel)
break;
--endy1;
if (endy1 < _y)
if (endy1 < _y) {
g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(_x, _y), g_fullpipe->_backgroundSurface.pitch, _x, _y, endx, endy);

return;
}
pos = _x;
}

if (pixel == 0x100)
if (pixel == 0x100) {
g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(_x, _y), g_fullpipe->_backgroundSurface.pitch, _x, _y, endx, endy);
return;
}

if (pixel != 0x200)
break;

pixel1 = *(int16 *)srcPtr;
pixel1 = *(uint16 *)srcPtr;
srcPtr += 2;
pos += (byte)pixel1;
pos += (byte)(pixel1 && 0xff);
pixel1High = pixel1 >> 8;

if (pixel1High) {
endy1 -= pixel1High;

if (endy1 < _y)
if (endy1 < _y) {
g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(_x, _y), g_fullpipe->_backgroundSurface.pitch, start, _y, endx, endy);
return;
}
}
}
start1 = pos;
fillValue = (byte)pixel;
fillValue = (byte)(pixel & 0xff);

if (!(byte)pixel)
break;

pos += (byte)pixel;
pos += (byte)(pixel & 0xff);
pixoffset = -start1;

if (pixoffset <= 0)
goto LABEL_25;

fillValue = (byte)pixel - pixoffset;
fillValue = (byte)(pixel & 0xff) - pixoffset;

if (fillValue > 0) {
start1 = 0;
Expand All @@ -469,9 +470,8 @@ void Bitmap::putDib(int x, int y, byte *palette) {
end2 = 799;
if (pos <= end2 + 1 || (fillValue += end2 - pos + 1, fillValue > 0)) {
if (endy1 <= endy) {
curDestPtr = (int16 *)g_fullpipe->_backgroundSurface.getBasePtr(endy1, start1);
int bgcolor = *(int32 *)(palette + 4 * ((pixel >> 8) & 0xff));

curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, endy1);
int bgcolor = palette[(pixel >> 8) & 0xff];
colorFill(curDestPtr, fillValue, bgcolor);
}
goto LABEL_17;
Expand All @@ -495,7 +495,7 @@ void Bitmap::putDib(int x, int y, byte *palette) {
continue;
}
if (endy1 <= endy) {
curDestPtr = (int16 *)g_fullpipe->_backgroundSurface.getBasePtr(endy1, start1);
curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start1, endy1);
paletteFill(curDestPtr, srcPtr2, pixelHigh, (int32 *)palette);
}
}
Expand Down Expand Up @@ -524,13 +524,13 @@ void Bitmap::putDib(int x, int y, byte *palette) {

if (_flags & 0x1000000) {
for (int n = _y; n < endy; srcPtr1 -= pitch) {
curDestPtr = (int16 *)g_fullpipe->_backgroundSurface.getBasePtr(start, n);
curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start, n);
copierKeyColor(curDestPtr, srcPtr1, end - start + 1, _flags & 0xff, (int32 *)palette, cb05_format);
++n;
}
} else {
for (int n = _y; n <= endy; srcPtr1 -= pitch) {
curDestPtr = (int16 *)g_fullpipe->_backgroundSurface.getBasePtr(start, n);
curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start, n);
copier(curDestPtr, srcPtr1, end - start + 1, (int32 *)palette, cb05_format);
++n;
}
Expand All @@ -539,7 +539,7 @@ void Bitmap::putDib(int x, int y, byte *palette) {
g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(start, _y), g_fullpipe->_backgroundSurface.pitch, start, _y, end, endy);
}

void Bitmap::colorFill(int16 *dest, int len, int color) {
void Bitmap::colorFill(uint16 *dest, int len, int32 color) {
#if 0
if (blendMode) {
if (blendMode != 1)
Expand All @@ -552,10 +552,10 @@ void Bitmap::colorFill(int16 *dest, int len, int color) {
#endif

for (int i = 0; i < len; i++)
*dest++ = (int16)color;
*dest++ = (int16)(color & 0xffff);
}

void Bitmap::paletteFill(int16 *dest, byte *src, int len, int32 *palette) {
void Bitmap::paletteFill(uint16 *dest, byte *src, int len, int32 *palette) {
#if 0
if (blendMode) {
if (blendMode != 1)
Expand All @@ -568,10 +568,10 @@ void Bitmap::paletteFill(int16 *dest, byte *src, int len, int32 *palette) {
#endif

for (int i = 0; i < len; i++)
*dest++ = palette[*src++];
*dest++ = READ_LE_UINT32(&palette[*src++]) & 0xffff;
}

void Bitmap::copierKeyColor(int16 *dest, byte *src, int len, int keyColor, int32 *palette, bool cb05_format) {
void Bitmap::copierKeyColor(uint16 *dest, byte *src, int len, int keyColor, int32 *palette, bool cb05_format) {
#if 0
if (blendMode) {
if (blendMode == 1) {
Expand All @@ -592,7 +592,7 @@ void Bitmap::copierKeyColor(int16 *dest, byte *src, int len, int keyColor, int32
if (!cb05_format) {
for (int i = 0; i < len; i++) {
if (*src != keyColor)
*dest = palette[*src];
*dest = READ_LE_UINT32(&palette[*src]) & 0xffff;

dest++;
src++;
Expand All @@ -610,7 +610,7 @@ void Bitmap::copierKeyColor(int16 *dest, byte *src, int len, int keyColor, int32
}
}

void Bitmap::copier(int16 *dest, byte *src, int len, int32 *palette, bool cb05_format) {
void Bitmap::copier(uint16 *dest, byte *src, int len, int32 *palette, bool cb05_format) {
#if 0
if (blendMode) {
if (blendMode == 1) {
Expand All @@ -630,7 +630,7 @@ void Bitmap::copier(int16 *dest, byte *src, int len, int32 *palette, bool cb05_f

if (!cb05_format) {
for (int i = 0; i < len; i++)
*dest++ = palette[*src++];
*dest++ = READ_LE_UINT32(&palette[*src++]) & 0xffff;
} else {
int16 *src16 = (int16 *)src;

Expand Down
10 changes: 5 additions & 5 deletions engines/fullpipe/gfx.h
Expand Up @@ -42,12 +42,12 @@ struct Bitmap {
int _flags;

void load(Common::ReadStream *s);
void putDib(int x, int y, byte *palette);
void putDib(int x, int y, int32 *palette);

void colorFill(int16 *dest, int len, int color);
void paletteFill(int16 *dest, byte *src, int len, int32 *palette);
void copierKeyColor(int16 *dest, byte *src, int len, int keyColor, int32 *palette, bool cb05_format);
void copier(int16 *dest, byte *src, int len, int32 *palette, bool cb05_format);
void colorFill(uint16 *dest, int len, int color);
void paletteFill(uint16 *dest, byte *src, int len, int32 *palette);
void copierKeyColor(uint16 *dest, byte *src, int len, int keyColor, int32 *palette, bool cb05_format);
void copier(uint16 *dest, byte *src, int len, int32 *palette, bool cb05_format);
};

class Picture : public MemoryObject {
Expand Down

0 comments on commit 4554ac2

Please sign in to comment.