use memcmp() to compare QImage objects without color tables

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-12-18 00:55:10 +02:00
parent 08e5d5b8f9
commit 9be2a56ea8

View file

@ -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)) {