diff options
author | Alyssa Milburn | 2011-04-14 21:06:06 +0200 |
---|---|---|
committer | Alyssa Milburn | 2011-04-14 21:06:06 +0200 |
commit | 6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6 (patch) | |
tree | afd979ae23209d820c9aec88ed2572afa908bbed /engines/sword25 | |
parent | a762173794935efe4ab4d229fdc73f4d9c65e5ab (diff) | |
download | scummvm-rg350-6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6.tar.gz scummvm-rg350-6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6.tar.bz2 scummvm-rg350-6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6.zip |
SWORD25: Fix rendering on big-endian.
Diffstat (limited to 'engines/sword25')
-rw-r--r-- | engines/sword25/gfx/graphicengine.cpp | 11 | ||||
-rw-r--r-- | engines/sword25/gfx/image/renderedimage.cpp | 48 | ||||
-rw-r--r-- | engines/sword25/gfx/image/vectorimagerenderer.cpp | 11 |
3 files changed, 66 insertions, 4 deletions
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp index 5fefcec420..502d2d3b2a 100644 --- a/engines/sword25/gfx/graphicengine.cpp +++ b/engines/sword25/gfx/graphicengine.cpp @@ -206,6 +206,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) { for (int i = rect.top; i < rect.bottom; i++) { out = outo; for (int j = rect.left; j < rect.right; j++) { +#if defined(SCUMM_LITTLE_ENDIAN) *out += (byte)(((cb - *out) * ca) >> 8); out++; *out += (byte)(((cg - *out) * ca) >> 8); @@ -214,6 +215,16 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) { out++; *out = 255; out++; +#else + *out = 255; + out++; + *out += (byte)(((cr - *out) * ca) >> 8); + out++; + *out += (byte)(((cg - *out) * ca) >> 8); + out++; + *out += (byte)(((cb - *out) * ca) >> 8); + out++; +#endif } outo += _backSurface.pitch; diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index ced3296e57..1cc5d50e90 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -267,10 +267,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe out = outo; in = ino; for (int j = 0; j < img->w; j++) { - int b = in[0]; - int g = in[1]; - int r = in[2]; - int a = in[3]; + uint32 pix = *(uint32*)in; + int b = (pix >> 0) & 0xff; + int g = (pix >> 8) & 0xff; + int r = (pix >> 16) & 0xff; + int a = (pix >> 24) & 0xff; in += inStep; if (ca != 255) { @@ -282,6 +283,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe out += 4; break; case 255: // Full opacity +#if defined(SCUMM_LITTLE_ENDIAN) if (cb != 255) *out++ = (b * cb) >> 8; else @@ -298,9 +300,28 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe *out++ = r; *out++ = a; +#else + *out++ = a; + + if (cr != 255) + *out++ = (r * cr) >> 8; + else + *out++ = r; + + if (cg != 255) + *out++ = (g * cg) >> 8; + else + *out++ = g; + + if (cb != 255) + *out++ = (b * cb) >> 8; + else + *out++ = b; +#endif break; default: // alpha blending +#if defined(SCUMM_LITTLE_ENDIAN) if (cb != 255) *out += ((b - *out) * a * cb) >> 16; else @@ -318,6 +339,25 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe out++; *out = 255; out++; +#else + *out = 255; + out++; + if (cr != 255) + *out += ((r - *out) * a * cr) >> 16; + else + *out += ((r - *out) * a) >> 8; + out++; + if (cg != 255) + *out += ((g - *out) * a * cg) >> 16; + else + *out += ((g - *out) * a) >> 8; + out++; + if (cb != 255) + *out += ((b - *out) * a * cb) >> 16; + else + *out += ((b - *out) * a) >> 8; + out++; +#endif } } outo += _backSurface->pitch; diff --git a/engines/sword25/gfx/image/vectorimagerenderer.cpp b/engines/sword25/gfx/image/vectorimagerenderer.cpp index e8acd08909..99a47015fb 100644 --- a/engines/sword25/gfx/image/vectorimagerenderer.cpp +++ b/engines/sword25/gfx/image/vectorimagerenderer.cpp @@ -67,6 +67,7 @@ void art_rgb_run_alpha1(byte *buf, byte r, byte g, byte b, int alpha, int n) { int v; for (i = 0; i < n; i++) { +#if defined(SCUMM_LITTLE_ENDIAN) v = *buf; *buf++ = v + (((b - v) * alpha + 0x80) >> 8); v = *buf; @@ -75,6 +76,16 @@ void art_rgb_run_alpha1(byte *buf, byte r, byte g, byte b, int alpha, int n) { *buf++ = v + (((r - v) * alpha + 0x80) >> 8); v = *buf; *buf++ = MIN(v + alpha, 0xff); +#else + v = *buf; + *buf++ = MIN(v + alpha, 0xff); + v = *buf; + *buf++ = v + (((r - v) * alpha + 0x80) >> 8); + v = *buf; + *buf++ = v + (((g - v) * alpha + 0x80) >> 8); + v = *buf; + *buf++ = v + (((b - v) * alpha + 0x80) >> 8); +#endif } } |