summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2009-05-27 11:23:53 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2009-05-27 11:30:06 (GMT)
commit71cb35e942b94e4dba2055acdebbf90c352da762 (patch)
tree9b1e845fc52698051badc263bb4cc01345c9f01f /src/gui/image
parent73e7d0cbed0261715f534d95f81055bf97ce4314 (diff)
downloadQt-71cb35e942b94e4dba2055acdebbf90c352da762.zip
Qt-71cb35e942b94e4dba2055acdebbf90c352da762.tar.gz
Qt-71cb35e942b94e4dba2055acdebbf90c352da762.tar.bz2
Add comparation of images with indexed color
Previously, two images with indexed colors were not equal if their color tables were not the same. The image are not compared by the value of the pixels Reviewed-by: Samuel
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qimage.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 25c68bc..c1c5631 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4853,8 +4853,6 @@ bool QImage::operator==(const QImage & i) const
return false;
if (d->format != Format_RGB32) {
- if (d->colortable != i.d->colortable)
- return false;
if (d->format >= Format_ARGB32) { // all bits defined
const int n = d->width * d->depth / 8;
if (n == d->bytes_per_line && n == i.d->bytes_per_line) {
@@ -4867,11 +4865,13 @@ bool QImage::operator==(const QImage & i) const
}
}
} else {
- int w = width();
- int h = height();
+ const int w = width();
+ const int h = height();
+ const QVector<QRgb> &colortable = d->colortable;
+ const QVector<QRgb> &icolortable = i.d->colortable;
for (int y=0; y<h; ++y) {
for (int x=0; x<w; ++x) {
- if (pixelIndex(x, y) != i.pixelIndex(x, y))
+ if (colortable[pixelIndex(x, y)] != icolortable[i.pixelIndex(x, y)])
return false;
}
}