r14589 by fschmid - DRW Importer: don't create Lines when start and end point are the same.
scribus-commit
scribus-commit at lists.scribus.net
Mon Feb 1 13:21:41 CET 2010
Revision: 14589
Author: fschmid
Date: 2010-01-28T18:01:45.329331Z
Commit message: DRW Importer: don't create Lines when start and end point are the same.
Changeset:
M /trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
Diffs:
Index: scribus/plugins/import/drw/importdrw.cpp
===================================================================
--- scribus/plugins/import/drw/importdrw.cpp (revision 14588)
+++ scribus/plugins/import/drw/importdrw.cpp (revision 14589)
@@ -557,7 +557,7 @@
QPointF startP;
int a = 0;
QPainterPath pa;
- while (a < nrOfPoints)
+ while (a < nrOfPoints-1)
{
if (first)
{
@@ -568,7 +568,11 @@
first = false;
}
QPointF p1 = getCoordinate(ds);
+ if ((p1.x() < -32768) || (p1.x() > 32768) || (p1.y() < -32768) || (p1.y() > 32768))
+ qDebug() << "Invalid Point";
QPointF p2 = getCoordinate(ds);
+ if ((p2.x() < -32768) || (p2.x() > 32768) || (p2.y() < -32768) || (p2.y() > 32768))
+ qDebug() << "Invalid Point";
a += 2;
pa.quadTo(p1.x(), p1.y(), p2.x(), p2.y());
}
@@ -1281,6 +1285,8 @@
cmdText += "Line";
posEnd = getCoordinate(ds);
posStart = getCoordinate(ds);
+ if (posStart == posEnd)
+ break;
if ((posEnd.x() < 0) || (posEnd.y() < 0) || (posStart.x() < 0) || (posStart.y() < 0))
{
QPointF tmp = posEnd;
@@ -1465,9 +1471,11 @@
backColor = getColor(ds);
lineWidth = getValue(ds);
nrOfPoints = nPoints;
-// createObjCode = 4;
-// z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX + bBox.x() + bX + groupX, baseY + bBox.y() + bY + groupY, bBox.width(), bBox.height(), lineWidth, fillC, lineColor, true);
-// currentItem = m_Doc->Items->at(z);
+ createObjCode = 4;
+ z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX + bBox.x() + bX + groupX, baseY + bBox.y() + bY + groupY, bBox.width(), bBox.height(), lineWidth, fillC, lineColor, true);
+ currentItem = m_Doc->Items->at(z);
+ handleLineStyle(currentItem, flags, lineColor);
+ handleGradient(currentItem, patternIndex, fillColor, backColor, bBox);
break;
case 17:
ds >> patternIndex;
@@ -1529,9 +1537,10 @@
backColor = getColor(ds);
lineWidth = getValue(ds);
nrOfPoints = nPoints;
-// createObjCode = 4;
-// z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX + bBox.x() + bX + groupX, baseY + bBox.y() + bY + groupY, bBox.width(), bBox.height(), lineWidth, fillC, lineColor, true);
-// currentItem = m_Doc->Items->at(z);
+ createObjCode = 4;
+ z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX + bBox.x() + bX + groupX, baseY + bBox.y() + bY + groupY, bBox.width(), bBox.height(), lineWidth, fillC, lineColor, true);
+ currentItem = m_Doc->Items->at(z);
+ handleLineStyle(currentItem, flags, lineColor);
break;
case 20:
cmdText += "complex Polyline";
@@ -1964,25 +1973,21 @@
{
ite->ClipEdited = true;
ite->FrameType = 3;
-// FPoint wh = getMaxClipF(&ite->PoLine);
-// ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
-// m_Doc->AdjustItemSize(ite);
if (scale)
{
QPainterPath pa = ite->PoLine.toQPainterPath(true);
QRectF bb = pa.boundingRect();
double scx = 1.0;
double scy = 1.0;
- if ((bb.width() == 0.0) || (ite->width() == 0.0))
+ if ((bb.width() != 0.0) && (ite->width() != 0.0))
+ scx = ite->width() / bb.width();
+ else
scx = 1.0;
+ if ((bb.height() != 0.0) && (ite->height() != 0.0))
+ scy = ite->height() / bb.height();
else
- scx = ite->width() / bb.width();
- if ((bb.height() == 0.0) || (ite->height() == 0.0))
scy = 1.0;
- else
- scy = ite->height() / bb.height();
-// qDebug() << scx << scy;
ite->PoLine.scale(scx, scy);
ite->setLineWidth(ite->lineWidth() / qMin(scx, scy));
}
@@ -1992,7 +1997,7 @@
Elements.append(ite);
if (groupStack.count() != 0)
groupStack.top().GElements.append(ite);
- if (listStack.count() != 0)
+ if (listStack.count() > 1)
listStack.top().GElements.append(ite);
Coords.resize(0);
Coords.svgInit();
More information about the scribus-commit
mailing list