[Scummvm-git-logs] scummvm master -> de5c31fb5eea53b51f7639bf72cfd01490303972

alxpnv a04198622 at gmail.com
Tue Jun 15 12:07:03 UTC 2021


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:
de5c31fb5e ASYLUM: fix graphics glitches caused by a bug in Screen::blitMasked()


Commit: de5c31fb5eea53b51f7639bf72cfd01490303972
    https://github.com/scummvm/scummvm/commit/de5c31fb5eea53b51f7639bf72cfd01490303972
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-06-15T15:05:21+03:00

Commit Message:
ASYLUM: fix graphics glitches caused by a bug in Screen::blitMasked()

Changed paths:
    engines/asylum/system/screen.cpp


diff --git a/engines/asylum/system/screen.cpp b/engines/asylum/system/screen.cpp
index 66c72a43da..5995954937 100644
--- a/engines/asylum/system/screen.cpp
+++ b/engines/asylum/system/screen.cpp
@@ -946,7 +946,7 @@ void Screen::blitMasked(GraphicFrame *frame, Common::Rect *source, byte *maskDat
 	byte *mirroredBuffer = NULL;
 	int16 frameRight = frame->surface.pitch;
 	uint16 maskHeight = (uint16)sourceMask->height(); // for debugging only
-	byte zoom = ABS(sourceMask->left) & 7;
+	byte nSkippedBits = sourceMask->left % 8;
 
 	// Prepare temporary source buffer if needed
 	if (flags & kDrawFlagMirrorLeftRight) {
@@ -996,9 +996,9 @@ void Screen::blitMasked(GraphicFrame *frame, Common::Rect *source, byte *maskDat
 	}
 
 	if (destination->left > destMask->left) {
-		zoom += abs(destination->left - destMask->left) & 7;
-		zoom &= 7;
-		maskBufferPtr += ((destination->left - destMask->left) + zoom) / 8;
+		nSkippedBits += (destination->left - destMask->left) % 8;
+		maskBufferPtr += (destination->left - destMask->left) / 8 + nSkippedBits / 8;
+		nSkippedBits %= 8;
 		sourceMask->setWidth(sourceMask->width() + destMask->left - destination->left);
 		destMask->left = destination->left;
 	}
@@ -1081,8 +1081,8 @@ void Screen::blitMasked(GraphicFrame *frame, Common::Rect *source, byte *maskDat
 	          source->height(),
 	          source->width(),
 	          (uint16)(frameRight - source->width()),
-	          (uint16)(maskWidth - (zoom + source->width())) / 8,
-	          zoom,
+	          (uint16)(maskWidth - (nSkippedBits + source->width())) / 8,
+	          nSkippedBits,
 	          (byte *)_backBuffer.getPixels() + _backBuffer.pitch * destination->top + destination->left,
 	          (uint16)(_backBuffer.pitch - source->width()));
 
@@ -1122,15 +1122,14 @@ void Screen::drawZoomedMask(byte *mask, uint16 height, uint16 width, uint16 mask
 	}
 }
 
-void Screen::bltMasked(byte *srcBuffer, byte *maskBuffer, int16 height, int16 width, uint16 srcPitch, uint16 maskPitch, byte zoom, byte *dstBuffer, uint16 dstPitch) const {
-	if (zoom > 7)
-		error("[Screen::bltMasked] Invalid zoom value (was: %d, max: 7)", zoom);
+void Screen::bltMasked(byte *srcBuffer, byte *maskBuffer, int16 height, int16 width, uint16 srcPitch, uint16 maskPitch, byte nSkippedBits, byte *dstBuffer, uint16 dstPitch) const {
+	if (nSkippedBits > 7)
+		error("[Screen::bltMasked] Invalid number of skipped bits (was: %d, max: 7)", nSkippedBits);
 
 	while (height--) {
-
-		// Calculate current zoom and run length
-		int run = (7 - zoom);
-		uint skip = (*maskBuffer >> zoom);
+		// Calculate current run length
+		int run = 7 - nSkippedBits;
+		uint skip = *maskBuffer >> nSkippedBits;
 
 		for (int16 i = 0; i < width; i++) {
 			// Set destination value




More information about the Scummvm-git-logs mailing list