From 9be2a56ea885ab5d732badc7ef83fec712c1de3e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 18 Dec 2021 00:55:10 +0200 Subject: [PATCH] use memcmp() to compare QImage objects without color tables Signed-off-by: Ivailo Monev --- src/gui/image/qimage.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index e69e8b1ca..21b1a13cb 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3806,6 +3806,11 @@ bool QImage::operator==(const QImage & i) const return false; } + if (i.d->format == d->format && i.d->nbytes == d->nbytes + && d->format >= QImage::Format_RGB32 && d->format <= QImage::Format_RGB16) { + return (memcmp(constBits(), i.constBits(), d->nbytes) == 0); + } + for (int h = 0; h < d->height; h++) { for (int w = 0; w < d->width; w++) { if (pixel(w, h) != i.pixel(w, h)) {