diff options
Diffstat (limited to 'cppcanvas')
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 2e67d9f219b0..8409d7f302c0 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -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; } |