Kaydet (Commit) 35fb870b authored tarafından Caolán McNamara's avatar Caolán McNamara

fix crash on invalid/missing pen

üst 83072436
......@@ -902,7 +902,7 @@ namespace cppcanvas
} else {
rState.isFillColorSet = true;
// extract UseBrush
EMFPBrush* brush = (EMFPBrush*) aObjects [brushIndexOrColor];
EMFPBrush* brush = (EMFPBrush*) aObjects [brushIndexOrColor & 0xff];
EMFP_DEBUG (printf ("EMF+\tbrush fill slot: %u (type: %u)\n", (unsigned int)brushIndexOrColor, (unsigned int)brush->GetType ()));
// give up in case something wrong happened
......@@ -1356,31 +1356,37 @@ namespace cppcanvas
EMFP_DEBUG (printf ("EMF+\tpen: %u\n", (unsigned int)penIndex));
EMFPPath* path = (EMFPPath*) aObjects [flags & 0xff];
EMFPPen* pen = (EMFPPen*) aObjects [penIndex];
EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff];
rState.isFillColorSet = false;
rState.isLineColorSet = true;
rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (),
rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace());
::basegfx::B2DPolyPolygon& polygon (path->GetPolygon (*this));
SAL_WARN_IF( !pen, "cppcanvas", "EmfPlusRecordTypeDrawPath missing pen" );
SAL_WARN_IF( !path, "cppcanvas", "EmfPlusRecordTypeDrawPath missing path" );
polygon.transform( rState.mapModeTransform );
rendering::StrokeAttributes aStrokeAttributes;
if (pen && path)
{
rState.isFillColorSet = false;
rState.isLineColorSet = true;
rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (),
rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace());
::basegfx::B2DPolyPolygon& polygon (path->GetPolygon (*this));
pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
polygon.transform( rState.mapModeTransform );
rendering::StrokeAttributes aStrokeAttributes;
ActionSharedPtr pPolyAction(
internal::PolyPolyActionFactory::createPolyPolyAction(
polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) );
pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
if( pPolyAction )
{
maActions.push_back(
MtfAction(
pPolyAction,
rFactoryParms.mrCurrActionIndex ) );
ActionSharedPtr pPolyAction(
internal::PolyPolyActionFactory::createPolyPolyAction(
polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) );
rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
if( pPolyAction )
{
maActions.push_back(
MtfAction(
pPolyAction,
rFactoryParms.mrCurrActionIndex ) );
rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
}
}
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