r19189 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:19:42 UTC 2014


Author: jghali
Date: Sat Jun  7 12:19:42 2014
New Revision: 19189

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

Modified:
    branches/Version14x/Scribus/scribus/scimage.cpp

Modified: branches/Version14x/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19189&path=/branches/Version14x/Scribus/scribus/scimage.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scimage.cpp (original)
+++ branches/Version14x/Scribus/scribus/scimage.cpp Sat Jun  7 12:19:42 2014
@@ -1698,6 +1698,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;
@@ -1746,12 +1747,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;
@@ -1762,6 +1763,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];
 			}
 		}
 	}
@@ -1909,6 +1912,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;
@@ -1945,13 +1949,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