r16920 by jghali - easy speedup for LineControl::endOfLine()

scribus-commit scribus-commit at lists.scribus.net
Sat Oct 22 13:13:13 UTC 2011


Author: jghali
Date: Sat Oct 22 13:13:13 2011
New Revision: 16920

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16920
Log:
easy speedup for LineControl::endOfLine()

Modified:
    branches/Version135/Scribus/scribus/pageitem_textframe.cpp

Modified: branches/Version135/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16920&path=/branches/Version135/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/pageitem_textframe.cpp (original)
+++ branches/Version135/Scribus/scribus/pageitem_textframe.cpp Sat Oct 22 13:13:13 2011
@@ -520,19 +520,21 @@
 		double StartX = floor(qMax(line.x, qMin(maxX,breakXPos-maxShrink-1))-1);
 		int xPos  = static_cast<int>(ceil(maxX));
 
-		QPoint pt12 (xPos, Yasc);
-		QPoint pt22 (xPos, Ydesc);
-		QRect pt(pt12,pt22);
+		QPoint  pt12 (xPos, Yasc);
+		QPoint  pt22 (xPos, Ydesc);
+		QRect   pt(pt12,pt22);
+		QRegion region; 
 
 		double EndX2 = StartX;
 		double Interval = 0.25;
 		do {
 			int xP = static_cast<int>(ceil(EndX2 + morespace));
 			pt.moveTopLeft(QPoint(xP, Yasc));
-			if (!QRegion(pf2.mapToPolygon(pt)).subtracted(shape).isEmpty())
+			region = QRegion(pf2.mapToPolygon(pt)).subtracted(shape);
+			if (!region.isEmpty())
 				break;
 			EndX2 += Interval;
-		} while ((EndX2 < maxX) && QRegion(pf2.mapToPolygon(pt)).subtracted(shape).isEmpty());
+		} while ((EndX2 < maxX) && region.isEmpty());
 
 		return qMin(EndX2, maxX);
 	}




More information about the scribus-commit mailing list