aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Cawley2017-09-05 20:57:26 +0100
committerEugene Sandulenko2017-09-11 08:13:09 +0200
commite9aa47f55ce60bce599b4db35d69261ac8932eba (patch)
tree54ea5dca09915d1f62e9e93a7bcf4340e8168f41
parent6558578f5423b3e1f072a4a06e12a51f48e91102 (diff)
downloadscummvm-rg350-e9aa47f55ce60bce599b4db35d69261ac8932eba.tar.gz
scummvm-rg350-e9aa47f55ce60bce599b4db35d69261ac8932eba.tar.bz2
scummvm-rg350-e9aa47f55ce60bce599b4db35d69261ac8932eba.zip
GRAPHICS: Compare all fields in a PixelFormat individually instead of using memcmp.
-rw-r--r--graphics/pixelformat.h10
1 files changed, 9 insertions, 1 deletions
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 {