[Scummvm-cvs-logs] scummvm master -> b72890ea30ba47e4817fd294879b255c28680c0b

sev- sev at scummvm.org
Mon May 2 22:19:23 CEST 2016


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:
b72890ea30 SCUMM HE: Implement premultiplied transparency rendering


Commit: b72890ea30ba47e4817fd294879b255c28680c0b
    https://github.com/scummvm/scummvm/commit/b72890ea30ba47e4817fd294879b255c28680c0b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-02T22:19:14+02:00

Commit Message:
SCUMM HE: Implement premultiplied transparency rendering

Changed paths:
    engines/scumm/he/moonbase/moonbase.cpp
    engines/scumm/he/wiz_he.cpp



diff --git a/engines/scumm/he/moonbase/moonbase.cpp b/engines/scumm/he/moonbase/moonbase.cpp
index a24d146..5eabd0a 100644
--- a/engines/scumm/he/moonbase/moonbase.cpp
+++ b/engines/scumm/he/moonbase/moonbase.cpp
@@ -104,8 +104,30 @@ void Moonbase::blitT14WizImage(uint8 *dst, int dstw, int dsth, int dstPitch, con
 					pixels -= code;
 				} else { // special case
 					if (width - pixels >= srcx) {
+						int alpha = code >> 1;
 						uint16 color = READ_LE_UINT16(singlesOffset);
-						WRITE_LE_UINT16(dst1, color);
+
+						//WRITE_LE_UINT16(dst1, color); // ENABLE_PREMUL_ALPHA = 0
+						// ENABLE_PREMUL_ALPHA = 2
+						if (alpha > 32) {
+							alpha -= 32;
+
+							uint32 orig = READ_LE_UINT16(dst1);
+							uint32 oR = orig & 0x7c00;
+							uint32 oG = orig & 0x03e0;
+							uint32 oB = orig & 0x1f;
+							uint32 dR = ((((color & 0x7c00) - oR) * alpha) >> 5) + oR;
+							uint32 dG = ((((color &  0x3e0) - oG) * alpha) >> 5) + oG;
+							uint32 dB = ((((color &   0x1f) - oB) * alpha) >> 5) + oB;
+
+							WRITE_LE_UINT16(dst1, (dR & 0x7c00) | (dG & 0x3e0) | (dB & 0x1f));
+						} else {
+							uint32 orig = READ_LE_UINT16(dst1);
+							uint32 pass1 = ((((orig << 16) | orig) & 0x3e07c1f * alpha) >> 5) & 0x3e07c1f;
+							uint32 pass2 = (((pass1 << 16) | pass1) + color) & 0xffff;
+							WRITE_LE_UINT16(dst1, pass2);
+						}
+
 						dst1 += 2;
 					}
 					singlesOffset += 2;
diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp
index fdb8982..055df25 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -1773,6 +1773,7 @@ void Wiz::copy555WizImage(uint8 *dst, uint8 *wizd, int dstPitch, int dstType,
 	switch (rawROP) {
 	default:
 	case 1:
+		// MMX_PREMUL_ALPHA_COPY
 		break;
 
 	case 2:






More information about the Scummvm-git-logs mailing list