r21663 by jghali - remove unnecessary calls to QList::indexOf() in PageItem_TextFrame::calcAvailableRegion()

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 17 20:25:05 UTC 2016


Author: jghali
Date: Sat Dec 17 20:25:05 2016
New Revision: 21663

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21663
Log:
remove unnecessary calls to QList::indexOf() in PageItem_TextFrame::calcAvailableRegion()

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21663&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Sat Dec 17 20:25:05 2016
@@ -207,7 +207,7 @@
 		if (!invertible) return QRegion();
 
 		int LayerLev = m_Doc->layerLevelFromID(LayerID);
-		uint docItemsCount=m_Doc->Items->count();
+		int docItemsCount = m_Doc->Items->count();
 		ScPage* Mp=0;
 		ScPage* Dp=0;
 		PageItem* docItem=0;
@@ -230,9 +230,8 @@
 				// #10642 : masterpage items interact only with items placed on same masterpage
 				if (docItem->OnMasterPage != OnMasterPage)
 					continue;
-				int did = m_Doc->MasterItems.indexOf(docItem);
 				LayerLevItem = m_Doc->layerLevelFromID(docItem->LayerID);
-				if (((did > thisid) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
+				if (((a > thisid) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
 				{
 					if (docItem->textFlowAroundObject())
 					{
@@ -264,29 +263,24 @@
 			{
 				thisid = Parent->asGroupFrame()->groupItemList.indexOf(this);
 				docItemsCount = Parent->asGroupFrame()->groupItemList.count();
-				for (uint a = 0; a < docItemsCount; ++a)
+				for (int a = thisid + 1; a < docItemsCount; ++a)
 				{
 					docItem = Parent->asGroupFrame()->groupItemList.at(a);
-					int did = Parent->asGroupFrame()->groupItemList.indexOf(docItem);
-					if (did > thisid)
-					{
-						if (docItem->textFlowAroundObject())
-						{
-							QRegion itemRgn = itemShape(docItem, 0, 0);
-							result = result.subtracted( canvasToLocalMat.map(itemRgn) );
-						}
+					if (docItem->textFlowAroundObject())
+					{
+						QRegion itemRgn = itemShape(docItem, 0, 0);
+						result = result.subtracted( canvasToLocalMat.map(itemRgn) );
 					}
 				}
 			}
 			else
 			{
 				thisid = m_Doc->Items->indexOf(this);
-				for (uint a = 0; a < docItemsCount; ++a)
+				for (int a = 0; a < docItemsCount; ++a)
 				{
 					docItem = m_Doc->Items->at(a);
-					int did = m_Doc->Items->indexOf(docItem);
 					LayerLevItem = m_Doc->layerLevelFromID(docItem->LayerID);
-					if (((did > thisid) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
+					if (((a > thisid) && (docItem->LayerID == LayerID)) || (LayerLevItem > LayerLev && m_Doc->layerFlow(docItem->LayerID)))
 					{
 						if (docItem->textFlowAroundObject())
 						{




More information about the scribus-commit mailing list