[Scummvm-git-logs] scummvm branch-2-9 -> ffb31c80b333b110b7ef2e26df36d6a5732a1905

sev- noreply at scummvm.org
Sat Nov 16 12:06:40 UTC 2024


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:
ffb31c80b3 QDENGINE: Clarify data type signs in RLE decoder


Commit: ffb31c80b333b110b7ef2e26df36d6a5732a1905
    https://github.com/scummvm/scummvm/commit/ffb31c80b333b110b7ef2e26df36d6a5732a1905
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-16T13:06:35+01:00

Commit Message:
QDENGINE: Clarify data type signs in RLE decoder

Changed paths:
    engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
    engines/qdengine/system/graphics/gr_draw_sprite_rle_z.cpp
    engines/qdengine/system/graphics/rle_compress.cpp
    engines/qdengine/system/graphics/rle_compress.h


diff --git a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
index f3b09fee35f..cbba2649d36 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite_rle.cpp
@@ -60,11 +60,11 @@ void grDispatcher::putSpr_rle(int x, int y, int sx, int sy, const class RLEBuffe
 	for (int i = 0; i < psy; i++) {
 		uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
 
-		const char *rle_header = p->header_ptr(py + i);
+		const int8 *rle_header = p->header_ptr(py + i);
 		const uint32 *rle_data = p->data_ptr(py + i);
 
 		int j = 0;
-		char count = 0;
+		int8 count = 0;
 		while (j < px) {
 			count = *rle_header++;
 			if (count > 0) {
@@ -265,11 +265,11 @@ void grDispatcher::putSprMask_rle(int x, int y, int sx, int sy, const RLEBuffer
 	for (int i = 0; i < psy; i++) {
 		uint16 *scr_buf = reinterpret_cast<uint16 *>(_screenBuf->getBasePtr(x, y));
 
-		const char *rle_header = p->header_ptr(py + i);
+		const int8 *rle_header = p->header_ptr(py + i);
 		const uint32 *rle_data = p->data_ptr(py + i);
 
 		int j = 0;
-		char count = 0;
+		int8 count = 0;
 		while (j < px) {
 			count = *rle_header++;
 			if (count > 0) {
diff --git a/engines/qdengine/system/graphics/gr_draw_sprite_rle_z.cpp b/engines/qdengine/system/graphics/gr_draw_sprite_rle_z.cpp
index d0cddfc786e..bc7471bca15 100644
--- a/engines/qdengine/system/graphics/gr_draw_sprite_rle_z.cpp
+++ b/engines/qdengine/system/graphics/gr_draw_sprite_rle_z.cpp
@@ -66,11 +66,11 @@ void grDispatcher::putSpr_rle_z(int x, int y, int z, int sx, int sy, const class
 			byte *scr_buf = reinterpret_cast<byte *>(screenBuf + yTable[y] + x3);
 			zbuf_t *z_buf = zbuffer_ + SizeX * y + x;
 
-			const char *rle_header = p->header_ptr(py + i);
+			const int8 *rle_header = p->header_ptr(py + i);
 			const uint32 *rle_data = p->data_ptr(py + i);
 
 			int j = 0;
-			char count = 0;
+			int8 count = 0;
 			while (j < px) {
 				count = *rle_header++;
 				if (count > 0) {
@@ -197,11 +197,11 @@ void grDispatcher::putSpr_rle_z(int x, int y, int z, int sx, int sy, const class
 			byte *scr_buf = reinterpret_cast<byte *>(screenBuf + yTable[y] + x3);
 			zbuf_t *z_buf = zbuffer_ + SizeX * y + x;
 
-			const char *rle_header = p->header_ptr(py + i);
+			const int8 *rle_header = p->header_ptr(py + i);
 			const uint32 *rle_data = p->data_ptr(py + i);
 
 			int j = 0;
-			char count = 0;
+			int8 count = 0;
 			while (j < px) {
 				count = *rle_header++;
 				if (count > 0) {
@@ -327,11 +327,11 @@ void grDispatcher::putSpr_rle_z(int x, int y, int z, int sx, int sy, const class
 			uint16 *scr_buf = reinterpret_cast<uint16 *>(screenBuf + yTable[y] + x * 2);
 			zbuf_t *z_buf = zbuffer_ + y * SizeX + x;
 
-			const char *rle_header = p->header_ptr(py + i);
+			const int8 *rle_header = p->header_ptr(py + i);
 			const uint32 *rle_data = p->data_ptr(py + i);
 
 			int j = 0;
-			char count = 0;
+			int8 count = 0;
 			while (j < px) {
 				count = *rle_header++;
 				if (count > 0) {
diff --git a/engines/qdengine/system/graphics/rle_compress.cpp b/engines/qdengine/system/graphics/rle_compress.cpp
index 4a7ef32be80..0e919b028f1 100644
--- a/engines/qdengine/system/graphics/rle_compress.cpp
+++ b/engines/qdengine/system/graphics/rle_compress.cpp
@@ -139,13 +139,13 @@ bool RLEBuffer::encode(int sx, int sy, const byte *buf) {
 					index++;
 
 				while (index < sx && buffer[index] == buffer[index - 1])
-					index --;
+					index--;
 
-				_header.push_back(static_cast<char>(count - index));
+				_header.push_back(static_cast<int8>(count - index));
 				for (int i = count; i < index; i++)
 					_data.push_back(buffer[i]);
 			} else {
-				_header.push_back(static_cast<char>(index - count));
+				_header.push_back(static_cast<int8>(index - count));
 				_data.push_back(pixel);
 			}
 
@@ -161,7 +161,7 @@ bool RLEBuffer::encode(int sx, int sy, const byte *buf) {
 }
 
 bool RLEBuffer::decode_line(int y, byte *out_buf) const {
-	const char *header_ptr = &*(_header.begin() + _header_offset[y]);
+	const int8 *header_ptr = &*(_header.begin() + _header_offset[y]);
 	const uint32 *data_ptr = &*(_data.begin() + _data_offset[y]);
 
 	uint32 *out_ptr = reinterpret_cast<uint32 *>(out_buf);
@@ -169,7 +169,7 @@ bool RLEBuffer::decode_line(int y, byte *out_buf) const {
 	int size = line_header_length(y);
 
 	for (int i = 0; i < size; i++) {
-		char count = *header_ptr++;
+		int8 count = *header_ptr++;
 		if (count > 0) {
 			for (int j = 0; j < count; j++)
 				*out_ptr++ = *data_ptr;
@@ -187,11 +187,11 @@ bool RLEBuffer::decode_line(int y, byte *out_buf) const {
 }
 
 bool RLEBuffer::decode_pixel(int x, int y, uint32 &pixel) {
-	const char *header_ptr = &*(_header.begin() + _header_offset[y]);
+	const int8 *header_ptr = &*(_header.begin() + _header_offset[y]);
 	const uint32 *data_ptr = &*(_data.begin() + _data_offset[y]);
 
 	int xx = 0;
-	char count = *header_ptr++;
+	int8 count = *header_ptr++;
 
 	while (xx + abs(count) < x) {
 		if (count > 0) {
diff --git a/engines/qdengine/system/graphics/rle_compress.h b/engines/qdengine/system/graphics/rle_compress.h
index 8196714f3ee..00282834ac8 100644
--- a/engines/qdengine/system/graphics/rle_compress.h
+++ b/engines/qdengine/system/graphics/rle_compress.h
@@ -57,7 +57,7 @@ public:
 		return _data.size();
 	}
 
-	const char *header_ptr(int y = 0) const {
+	const int8 *header_ptr(int y = 0) const {
 		return &*(_header.begin() + _header_offset[y]);
 	}
 	const uint32 *data_ptr(int y = 0) const {
@@ -74,7 +74,7 @@ private:
 	Std::vector<uint32> _header_offset;
 	Std::vector<uint32> _data_offset;
 
-	Std::vector<char> _header;
+	Std::vector<int8> _header;
 	Std::vector<uint32> _data;
 
 	int _bits_per_pixel;




More information about the Scummvm-git-logs mailing list