r17292 by jghali - minor code cleanup in ps importer
scribus-commit
scribus-commit at lists.scribus.net
Sat Feb 11 15:29:07 UTC 2012
Author: jghali
Date: Sat Feb 11 15:29:07 2012
New Revision: 17292
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17292
Log:
minor code cleanup in ps importer
Modified:
branches/Version14x/Scribus/scribus/plugins/import/ps/importps.cpp
Modified: branches/Version14x/Scribus/scribus/plugins/import/ps/importps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17292&path=/branches/Version14x/Scribus/scribus/plugins/import/ps/importps.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/import/ps/importps.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/import/ps/importps.cpp Sat Feb 11 15:29:07 2012
@@ -583,7 +583,7 @@
{
if ((Elements.count() != 0) && (lastPath == currPath))
{
- ite = Elements.at(Elements.count()-1);
+ ite = Elements.last();
ite->setFillColor(CurrColor);
ite->setFillTransparency(1.0 - Opacity);
lastPath = "";
@@ -627,7 +627,7 @@
// LineW = qMax(LineW, 0.01); // Set Linewidth to be a least 0.01 pts, a Stroke without a Linewidth makes no sense
if ((Elements.count() != 0) && (lastPath == currPath))
{
- ite = Elements.at(Elements.count()-1);
+ ite = Elements.last();
ite->setLineColor(CurrColor);
ite->setLineWidth(LineW);
ite->PLineEnd = CapStyle;
@@ -680,13 +680,14 @@
{
if (Coords.size() != 0)
{
- QString vers = QString(qVersion()).left(5);
- if (vers < "4.3.3")
+ QPainterPath tmpPath = Coords.toQPainterPath(true);
+ tmpPath = boundingBoxRect.intersected(tmpPath);
+ if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0))
{
- clipCoords = Coords;
+ clipCoords.fromQPainterPath(tmpPath);
z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
ite = m_Doc->Items->at(z);
- ite->PoLine = Coords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
+ ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
ite->ClipEdited = true;
ite->FrameType = 3;
@@ -712,42 +713,6 @@
gsStackMarks.push(gsStack.count());
m_Doc->GroupCounter++;
}
- else
- {
- QPainterPath tmpPath = Coords.toQPainterPath(true);
- tmpPath = boundingBoxRect.intersected(tmpPath);
- if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0))
- {
- clipCoords.fromQPainterPath(tmpPath);
- z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
- ite = m_Doc->Items->at(z);
- ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
- ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
- ite->ClipEdited = true;
- ite->FrameType = 3;
- FPoint wh = getMaxClipF(&ite->PoLine);
- ite->setWidthHeight(wh.x(),wh.y());
- ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
- m_Doc->AdjustItemSize(ite);
- ite->Groups.push(m_Doc->GroupCounter);
- if (groupStack.count() != 0)
- {
- QStack<int> groupOld = groupStack.top()->Groups;
- for (int gg = 0; gg < groupOld.count(); gg++)
- {
- ite->Groups.push(groupOld[gg]);
- }
- }
- ite->isGroupControl = true;
- ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
- ite->setTextFlowMode(PageItem::TextFlowDisabled);
- Elements.append(ite);
- groupStack.push(ite);
- elemCount.push(Elements.count());
- gsStackMarks.push(gsStack.count());
- m_Doc->GroupCounter++;
- }
- }
}
Coords = FPointArray(0);
lastPath = "";
@@ -774,7 +739,7 @@
Elements.removeLast();
}
else
- ite->groupsLastItem = Elements.at(Elements.count()-1);
+ ite->groupsLastItem = Elements.last();
gsStackMarks.pop();
}
}
@@ -865,7 +830,7 @@
Elements.removeLast();
}
else
- ite->groupsLastItem = Elements.at(Elements.count()-1);
+ ite->groupsLastItem = Elements.last();
}
}
}
More information about the scribus-commit
mailing list