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

bluegr noreply at scummvm.org
Wed Sep 4 05:32:19 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:
e2fccfe581 GRAPHICS: Normalize PixelFormat shift amounts to 0 for empty channels.


Commit: e2fccfe581b35c7cf86c07f19d21c2ccdee6494b
    https://github.com/scummvm/scummvm/commit/e2fccfe581b35c7cf86c07f19d21c2ccdee6494b
Author: elasota (1137273+elasota at users.noreply.github.com)
Date: 2024-09-04T08:32:16+03:00

Commit Message:
GRAPHICS: Normalize PixelFormat shift amounts to 0 for empty channels.

This fixes fromScummvmPixelFormat in the JPEG decoder not selecting the correct output format due to the comparisons failing.

Changed paths:
    graphics/pixelformat.h


diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index 539a4ded15b..4ba16d8d915 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -173,10 +173,12 @@ struct PixelFormat {
 		gLoss(8 - GBits),
 		bLoss(8 - BBits),
 		aLoss(8 - ABits),
-		rShift(RShift),
-		gShift(GShift),
-		bShift(BShift),
-		aShift(AShift) {}
+		rShift((RBits == 0) ? 0 : RShift),
+		gShift((GBits == 0) ? 0 : GShift),
+		bShift((BBits == 0) ? 0 : BShift),
+		aShift((ABits == 0) ? 0 : AShift)
+	{
+	}
 
 	/** Define a CLUT8 pixel format. */
 	static inline PixelFormat createFormatCLUT8() {
@@ -185,7 +187,6 @@ struct PixelFormat {
 
 	/** Check if two pixel formats are the same */
 	inline bool operator==(const PixelFormat &fmt) const {
-		// TODO: If aLoss==8, then the value of aShift is irrelevant, and should be ignored.
 		return bytesPerPixel == fmt.bytesPerPixel &&
 		       rLoss == fmt.rLoss &&
 		       gLoss == fmt.gLoss &&




More information about the Scummvm-git-logs mailing list