Kaydet (Commit) 3dfcc485 authored tarafından Caolán McNamara's avatar Caolán McNamara

crashtesting: div-by-zero on load of tdf48948-2.pptx

Change-Id: Id05f65543eeb06526535ce9eaee354b4789e2069
Reviewed-on: https://gerrit.libreoffice.org/72883
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 51c639d1
...@@ -684,37 +684,40 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, ...@@ -684,37 +684,40 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
} }
const sal_Int32 nShapes = aCycleChildren.size(); const sal_Int32 nShapes = aCycleChildren.size();
const sal_Int32 nConnectorRadius = nRadius * cos(basegfx::deg2rad(nSpanAngle / nShapes)); if (nShapes)
const sal_Int32 nConnectorAngle = nSpanAngle > 0 ? 0 : 180;
sal_Int32 idx = 0;
for (auto & aCurrShape : aCycleChildren)
{ {
const double fAngle = static_cast<double>(idx)*nSpanAngle/nShapes + nStartAngle; const sal_Int32 nConnectorRadius = nRadius * cos(basegfx::deg2rad(nSpanAngle / nShapes));
awt::Size aCurrSize = aChildSize; const sal_Int32 nConnectorAngle = nSpanAngle > 0 ? 0 : 180;
sal_Int32 nCurrRadius = nRadius;
if (aCurrShape->getSubType() == XML_conn) sal_Int32 idx = 0;
for (auto & aCurrShape : aCycleChildren)
{ {
aCurrSize = aConnectorSize; const double fAngle = static_cast<double>(idx)*nSpanAngle/nShapes + nStartAngle;
nCurrRadius = nConnectorRadius; awt::Size aCurrSize = aChildSize;
} sal_Int32 nCurrRadius = nRadius;
const awt::Point aCurrPos( if (aCurrShape->getSubType() == XML_conn)
aCenter.Width + nCurrRadius*sin(basegfx::deg2rad(fAngle)) - aCurrSize.Width/2, {
aCenter.Height - nCurrRadius*cos(basegfx::deg2rad(fAngle)) - aCurrSize.Height/2); aCurrSize = aConnectorSize;
nCurrRadius = nConnectorRadius;
}
const awt::Point aCurrPos(
aCenter.Width + nCurrRadius*sin(basegfx::deg2rad(fAngle)) - aCurrSize.Width/2,
aCenter.Height - nCurrRadius*cos(basegfx::deg2rad(fAngle)) - aCurrSize.Height/2);
aCurrShape->setPosition(aCurrPos); aCurrShape->setPosition(aCurrPos);
aCurrShape->setSize(aCurrSize); aCurrShape->setSize(aCurrSize);
aCurrShape->setChildSize(aCurrSize); aCurrShape->setChildSize(aCurrSize);
if (nRotationPath == XML_alongPath) if (nRotationPath == XML_alongPath)
aCurrShape->setRotation(fAngle * PER_DEGREE); aCurrShape->setRotation(fAngle * PER_DEGREE);
// connectors should be handled in conn, but we don't have // connectors should be handled in conn, but we don't have
// reference to previous and next child, so it's easier here // reference to previous and next child, so it's easier here
if (aCurrShape->getSubType() == XML_conn) if (aCurrShape->getSubType() == XML_conn)
aCurrShape->setRotation((nConnectorAngle + fAngle) * PER_DEGREE); aCurrShape->setRotation((nConnectorAngle + fAngle) * PER_DEGREE);
idx++; idx++;
}
} }
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment