r19190 by jghali - #12294: Image resampling sometimes does not fill the right-most column of pixels in the target image

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 7 12:21:09 UTC 2014


Author: jghali
Date: Sat Jun  7 12:21:09 2014
New Revision: 19190

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19190
Log:
#12294: Image resampling sometimes does not fill the right-most column of pixels in the target image

Modified:
    trunk/Scribus/scribus/scimage.cpp

Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19190&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp (original)
+++ trunk/Scribus/scribus/scimage.cpp Sat Jun  7 12:21:09 2014
@@ -1680,6 +1680,7 @@
 			register long fraccoltofill, fraccolleft = 0;
 			register int needcol;
 			nxP = (QRgb*)dst.scanLine(rowswritten++);
+			QRgb *nxPEnd = nxP + newcols;
 			fraccoltofill = SCALE;
 			a = r = g = b = HALFSCALE;
 			needcol = 0;
@@ -1728,12 +1729,12 @@
 			if ( fraccoltofill > 0 )
 			{
 				--xP;
-				a += fraccolleft * qAlpha( *xP );
+				a += fraccoltofill * qAlpha( *xP );
 				r += fraccoltofill * qRed( *xP );
 				g += fraccoltofill * qGreen( *xP );
 				b += fraccoltofill * qBlue( *xP );
 			}
-			if ( ! needcol )
+			if (nxP < nxPEnd)
 			{
 				r /= SCALE;
 				if ( r > maxval ) r = maxval;
@@ -1744,6 +1745,8 @@
 				a /= SCALE;
 				if ( a > maxval ) a = maxval;
 				*nxP = qRgba( (int)r, (int)g, (int)b, (int)a );
+				while (++nxP != nxPEnd)
+					nxP[0] = nxP[-1];
 			}
 		}
 	}
@@ -1891,6 +1894,7 @@
 				register long fraccoltofill, fraccolleft = 0;
 				register int needcol;
 				nxP = dst.scanLine(rowswritten++) + chIndex;
+				unsigned char *nxPEnd = nxP + newcols * nChannels;
 				fraccoltofill = SCALE;
 				p = HALFSCALE;
 				needcol = 0;
@@ -1927,13 +1931,15 @@
 				if (fraccoltofill > 0)
 				{
 					xP -= nChannels;
-					p += fraccolleft * (*xP);
-				}
-				if (!needcol)
+					p += fraccoltofill * (*xP);
+				}
+				if (nxP < nxPEnd)
 				{
 					p /= SCALE;
 					if ( p > maxval ) p = maxval;
 					*nxP = (unsigned char) p;
+					while ((nxP += nChannels) != nxPEnd)
+						nxP[0] = nxP[-nChannels];
 				}
 			}
 		}




More information about the scribus-commit mailing list