[Scummvm-git-logs] scummvm master -> 1273df2426494c4daeb9dd86aead43cd857fcb7a

AndywinXp noreply at scummvm.org
Mon Dec 26 19:29:00 UTC 2022


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

Summary:
8cfec8a3c9 SCUMM: Reuse bomp decoder for SMUSH RLE codec
1273df2426 SCUMM: Optimize BOMP raw copy when transparency is not needed


Commit: 8cfec8a3c964f35e6d0492956b0a89e3ddef283a
    https://github.com/scummvm/scummvm/commit/8cfec8a3c964f35e6d0492956b0a89e3ddef283a
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2022-12-26T20:28:54+01:00

Commit Message:
SCUMM: Reuse bomp decoder for SMUSH RLE codec

Changed paths:
    engines/scumm/bomp.cpp
    engines/scumm/bomp.h
    engines/scumm/smush/codec1.cpp


diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp
index e741559dfe8..4c04d399627 100644
--- a/engines/scumm/bomp.cpp
+++ b/engines/scumm/bomp.cpp
@@ -50,7 +50,7 @@ void decompressBomp(byte *dst, const byte *src, int w, int h) {
 	} while (--h);
 }
 
-void bompDecodeLine(byte *dst, const byte *src, int len) {
+void bompDecodeLine(byte *dst, const byte *src, int len, bool setZero) {
 	assert(len > 0);
 
 	int num;
@@ -64,12 +64,17 @@ void bompDecodeLine(byte *dst, const byte *src, int len) {
 		len -= num;
 		if (code & 1) {
 			color = *src++;
-			memset(dst, color, num);
+			if (setZero || color)
+				memset(dst, color, num);
+			dst += num;
 		} else {
-			memcpy(dst, src, num);
-			src += num;
+			while (num--) {
+				color = *src++;
+				if (setZero || color)
+					*dst = color;
+				dst++;
+			}
 		}
-		dst += num;
 	}
 }
 
diff --git a/engines/scumm/bomp.h b/engines/scumm/bomp.h
index 03f15747b55..abc37143ebf 100644
--- a/engines/scumm/bomp.h
+++ b/engines/scumm/bomp.h
@@ -31,7 +31,7 @@ void bompApplyMask(byte *line_buffer, byte *mask, byte maskbit, int32 size, byte
 void bompApplyShadow(int shadowMode, const byte *shadowPalette, const byte *line_buffer, byte *dst, int32 size, byte transparency, bool HE7Check = false);
 
 void decompressBomp(byte *dst, const byte *src, int w, int h);
-void bompDecodeLine(byte *dst, const byte *src, int size);
+void bompDecodeLine(byte *dst, const byte *src, int size, bool setZero = true);
 void bompDecodeLineReverse(byte *dst, const byte *src, int size);
 
 
diff --git a/engines/scumm/smush/codec1.cpp b/engines/scumm/smush/codec1.cpp
index 15dc7c0bcb7..087e4d53aaf 100644
--- a/engines/scumm/smush/codec1.cpp
+++ b/engines/scumm/smush/codec1.cpp
@@ -22,40 +22,18 @@
 
 #include "common/endian.h"
 
+#include "scumm/bomp.h"
+
 namespace Scumm {
 
 void smushDecodeRLE(byte *dst, const byte *src, int left, int top, int width, int height, int pitch) {
-	byte val, code;
-	int32 length;
-	int h = height, lineSize;
-
 	dst += top * pitch;
-	for (h = 0; h < height; h++) {
-		lineSize = READ_LE_UINT16(src);
-		src += 2;
+	do {
 		dst += left;
-		while (lineSize > 0) {
-			code = *src++;
-			lineSize--;
-			length = (code >> 1) + 1;
-			if (code & 1) {
-				val = *src++;
-				lineSize--;
-				if (val)
-					memset(dst, val, length);
-				dst += length;
-			} else {
-				lineSize -= length;
-				while (length--) {
-					val = *src++;
-					if (val)
-						*dst = val;
-					dst++;
-				}
-			}
-		}
-		dst += pitch - left - width;
-	}
+		bompDecodeLine(dst, src + 2, width, false);
+		src += READ_LE_UINT16(src) + 2;
+		dst += pitch - left;
+	} while (--height);
 }
 
 } // End of namespace Scumm


Commit: 1273df2426494c4daeb9dd86aead43cd857fcb7a
    https://github.com/scummvm/scummvm/commit/1273df2426494c4daeb9dd86aead43cd857fcb7a
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2022-12-26T20:28:54+01:00

Commit Message:
SCUMM: Optimize BOMP raw copy when transparency is not needed

Changed paths:
    engines/scumm/bomp.cpp


diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp
index 4c04d399627..3193055f368 100644
--- a/engines/scumm/bomp.cpp
+++ b/engines/scumm/bomp.cpp
@@ -68,11 +68,18 @@ void bompDecodeLine(byte *dst, const byte *src, int len, bool setZero) {
 				memset(dst, color, num);
 			dst += num;
 		} else {
-			while (num--) {
-				color = *src++;
-				if (setZero || color)
-					*dst = color;
-				dst++;
+			if (setZero) {
+				// Copy optimization when transparency is not needed
+				memcpy(dst, src, num);
+				src += num;
+				dst += num;
+			} else {
+				while (num--) {
+					color = *src++;
+					if (color)
+						*dst = color;
+					dst++;
+				}
 			}
 		}
 	}




More information about the Scummvm-git-logs mailing list