diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-11-06 15:22:28 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-11-09 12:36:32 (GMT) |
commit | cbfef77bb7bd370f7373edb78c2646328461d259 (patch) | |
tree | 1ce01db02b3e5b32e4db325e04f7120ad566c7ba /src/plugins | |
parent | 290f9182bb975061f68628008acd592e262a3f45 (diff) | |
download | Qt-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')
-rw-r--r-- | src/plugins/imageformats/jpeg/qjpeghandler.cpp | 5 |
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]; } } } |