summaryrefslogtreecommitdiffstats
path: root/src/plugins/imageformats/jpeg
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-11-06 15:22:28 (GMT)
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2009-11-09 12:36:32 (GMT)
commitcbfef77bb7bd370f7373edb78c2646328461d259 (patch)
tree1ce01db02b3e5b32e4db325e04f7120ad566c7ba /src/plugins/imageformats/jpeg
parent290f9182bb975061f68628008acd592e262a3f45 (diff)
downloadQt-cbfef77bb7bd370f7373edb78c2646328461d259.zip
Qt-cbfef77bb7bd370f7373edb78c2646328461d259.tar.gz
Qt-cbfef77bb7bd370f7373edb78c2646328461d259.tar.bz2
Fixed bug where JPEG scaling resulted in an uninitialised pixel column.
Loading a JPEG image after calling QImageReader::setScaledSize() could cause a 1 pixel wide column of uninitialised pixels at the far right of the image. The bug was caused by rounding in the scaling algorithm. Fixed by copying the last calculated pixel all the way to the end of the row. Task-number: QTBUG-3282 Reviewed-by: Trond
Diffstat (limited to 'src/plugins/imageformats/jpeg')
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index d51668a..e5e5e80 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -342,6 +342,7 @@ QImage QImageSmoothScaler::scale()
register int needcol;
nxP = (QRgb *)dst.scanLine(rowswritten++);
+ QRgb *nxPEnd = nxP + d->newcols;
fraccoltofill = SCALE;
a = r = g = b = HALFSCALE;
needcol = 0;
@@ -425,7 +426,7 @@ QImage QImageSmoothScaler::scale()
b += fraccoltofill * qBlue(*xP);
}
}
- if (!needcol) {
+ if (nxP < nxPEnd) {
r /= SCALE;
if (r > maxval)
r = maxval;
@@ -443,6 +444,8 @@ QImage QImageSmoothScaler::scale()
} else {
*nxP = qRgb((int)r, (int)g, (int)b);
}
+ while (++nxP != nxPEnd)
+ nxP[0] = nxP[-1];
}
}
}