r17751 by jghali - #10999: Speed up some loops for very long text in many linked frames
scribus-commit
scribus-commit at lists.scribus.net
Fri Aug 3 22:34:14 UTC 2012
Author: jghali
Date: Fri Aug 3 22:34:14 2012
New Revision: 17751
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17751
Log:
#10999: Speed up some loops for very long text in many linked frames
Modified:
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17751&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Fri Aug 3 22:34:14 2012
@@ -987,7 +987,9 @@
ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
}
}
- for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+ uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+ uint stop = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+ for (uint e = start; e < stop; ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
}
@@ -1037,7 +1039,9 @@
ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
}
}
- for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+ uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+ uint stop = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+ for (uint e = start; e < stop; ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
}
@@ -1087,7 +1091,9 @@
ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
}
}
- for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+ uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+ uint stop = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+ for (uint e = start; e < stop; ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
}
@@ -1143,7 +1149,9 @@
ReallyUsed.insert(pgit->itemText.defaultStyle().charStyle().font().replacementName(), DocFonts[pgit->itemText.defaultStyle().charStyle().font().replacementName()]);
}
}
- for (uint e = 0; e < static_cast<uint>(pgit->itemText.length()); ++e)
+ uint start = pgit->isTextFrame() ? (uint) pgit->firstInFrame() : 0;
+ uint stop = pgit->isTextFrame() ? (uint) pgit->lastInFrame() + 1 : (uint) pgit->itemText.length();
+ for (uint e = start; e < stop; ++e)
{
ReallyUsed.insert(pgit->itemText.charStyle(e).font().replacementName(), DocFonts[pgit->itemText.charStyle(e).font().replacementName()]);
}
Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17751&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdutil.cpp Fri Aug 3 22:34:14 2012
@@ -78,7 +78,7 @@
for (int c = 0; c < ScCore->primaryMainWindow()->doc->Items->count(); c++)
{
PageItem *ite = ScCore->primaryMainWindow()->doc->Items->at(c);
- if (ite->itemType() == PageItem::TextFrame)
+ if ((ite->itemType() == PageItem::TextFrame) && (ite->prevInChain() == NULL))
{
for (int d = 0; d < ite->itemText.length(); d++)
{
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17751&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Fri Aug 3 22:34:14 2012
@@ -3977,7 +3977,9 @@
Really.insert(it->itemText.defaultStyle().charStyle().font().replacementName(), QMap<uint, FPointArray>());
}
}*/
- for (int e = 0; e < it->itemText.length(); ++e)
+ int start = it->isTextFrame() ? it->firstInFrame() : 0;
+ int stop = it->isTextFrame() ? it->lastInFrame() + 1 : it->itemText.length();
+ for (int e = start; e < stop; ++e)
{
if (! Really.contains(it->itemText.charStyle(e).font().replacementName()) )
{
More information about the scribus-commit
mailing list