[Scummvm-cvs-logs] scummvm master -> 6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6

fuzzie fuzzie at fuzzie.org
Thu Apr 14 21:08:28 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
6ecc460b41 SWORD25: Fix rendering on big-endian.


Commit: 6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6
    https://github.com/scummvm/scummvm/commit/6ecc460b419690ba8bef8bbc3deb5af3f6c7bbc6
Author: Alyssa Milburn (fuzzie at fuzzie.org)
Date: 2011-04-14T12:06:06-07:00

Commit Message:
SWORD25: Fix rendering on big-endian.

Changed paths:
    engines/sword25/gfx/graphicengine.cpp
    engines/sword25/gfx/image/renderedimage.cpp
    engines/sword25/gfx/image/vectorimagerenderer.cpp



diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 5fefcec..502d2d3 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 ced3296..1cc5d50 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 e8acd08..99a4701 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
 	}
 }
 






More information about the Scummvm-git-logs mailing list