From e9aa47f55ce60bce599b4db35d69261ac8932eba Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Tue, 5 Sep 2017 20:57:26 +0100 Subject: GRAPHICS: Compare all fields in a PixelFormat individually instead of using memcmp. --- graphics/pixelformat.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h index 7b966a8a15..6b22a14142 100644 --- a/graphics/pixelformat.h +++ b/graphics/pixelformat.h @@ -159,7 +159,15 @@ struct PixelFormat { inline bool operator==(const PixelFormat &fmt) const { // TODO: If aLoss==8, then the value of aShift is irrelevant, and should be ignored. - return 0 == memcmp(this, &fmt, sizeof(PixelFormat)); + return bytesPerPixel == fmt.bytesPerPixel && + rLoss == fmt.rLoss && + gLoss == fmt.gLoss && + bLoss == fmt.bLoss && + aLoss == fmt.aLoss && + rShift == fmt.rShift && + gShift == fmt.gShift && + bShift == fmt.bShift && + aShift == fmt.aShift; } inline bool operator!=(const PixelFormat &fmt) const { -- cgit v1.2.3