diff options
Diffstat (limited to 'emfio')
-rw-r--r-- | emfio/source/reader/emfreader.cxx | 145 | ||||
-rw-r--r-- | emfio/source/reader/mtftools.cxx | 2 | ||||
-rw-r--r-- | emfio/source/reader/wmfreader.cxx | 4 |
3 files changed, 78 insertions, 73 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 2c353dc71694..af09ed2799cd 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -1239,79 +1239,84 @@ namespace emfio Color aColorRef = ReadColor(); mpInputStream->ReadInt32( elpHatch ).ReadUInt32( elpNumEntries ); - LineInfo aLineInfo; - if ( nWidth ) - aLineInfo.SetWidth( nWidth ); - - bool bTransparent = false; - - switch( nStyle & PS_STYLE_MASK ) + if (!mpInputStream->good()) + bStatus = false; + else { - case PS_DASHDOTDOT : - aLineInfo.SetStyle( LineStyle::Dash ); - aLineInfo.SetDashCount( 1 ); - aLineInfo.SetDotCount( 2 ); - break; - case PS_DASHDOT : - aLineInfo.SetStyle( LineStyle::Dash ); - aLineInfo.SetDashCount( 1 ); - aLineInfo.SetDotCount( 1 ); - break; - case PS_DOT : - aLineInfo.SetStyle( LineStyle::Dash ); - aLineInfo.SetDashCount( 0 ); - aLineInfo.SetDotCount( 1 ); - break; - case PS_DASH : - aLineInfo.SetStyle( LineStyle::Dash ); - aLineInfo.SetDashCount( 1 ); - aLineInfo.SetDotCount( 0 ); - break; - case PS_NULL : - bTransparent = true; - aLineInfo.SetStyle( LineStyle::NONE ); - break; + LineInfo aLineInfo; + if ( nWidth ) + aLineInfo.SetWidth( nWidth ); - case PS_INSIDEFRAME : - case PS_SOLID : - default : - aLineInfo.SetStyle( LineStyle::Solid ); - } - switch( nStyle & PS_ENDCAP_STYLE_MASK ) - { - case PS_ENDCAP_ROUND : - if ( aLineInfo.GetWidth() ) - { - aLineInfo.SetLineCap( css::drawing::LineCap_ROUND ); - break; - } - [[fallthrough]]; - case PS_ENDCAP_SQUARE : - if ( aLineInfo.GetWidth() ) - { - aLineInfo.SetLineCap( css::drawing::LineCap_SQUARE ); - break; - } - [[fallthrough]]; - case PS_ENDCAP_FLAT : - default : - aLineInfo.SetLineCap( css::drawing::LineCap_BUTT ); - } - switch( nStyle & PS_JOIN_STYLE_MASK ) - { - case PS_JOIN_ROUND : - aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::Round ); - break; - case PS_JOIN_MITER : - aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::Miter ); - break; - case PS_JOIN_BEVEL : - aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::Bevel ); - break; - default : - aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::NONE ); + bool bTransparent = false; + + switch( nStyle & PS_STYLE_MASK ) + { + case PS_DASHDOTDOT : + aLineInfo.SetStyle( LineStyle::Dash ); + aLineInfo.SetDashCount( 1 ); + aLineInfo.SetDotCount( 2 ); + break; + case PS_DASHDOT : + aLineInfo.SetStyle( LineStyle::Dash ); + aLineInfo.SetDashCount( 1 ); + aLineInfo.SetDotCount( 1 ); + break; + case PS_DOT : + aLineInfo.SetStyle( LineStyle::Dash ); + aLineInfo.SetDashCount( 0 ); + aLineInfo.SetDotCount( 1 ); + break; + case PS_DASH : + aLineInfo.SetStyle( LineStyle::Dash ); + aLineInfo.SetDashCount( 1 ); + aLineInfo.SetDotCount( 0 ); + break; + case PS_NULL : + bTransparent = true; + aLineInfo.SetStyle( LineStyle::NONE ); + break; + + case PS_INSIDEFRAME : + case PS_SOLID : + default : + aLineInfo.SetStyle( LineStyle::Solid ); + } + switch( nStyle & PS_ENDCAP_STYLE_MASK ) + { + case PS_ENDCAP_ROUND : + if ( aLineInfo.GetWidth() ) + { + aLineInfo.SetLineCap( css::drawing::LineCap_ROUND ); + break; + } + [[fallthrough]]; + case PS_ENDCAP_SQUARE : + if ( aLineInfo.GetWidth() ) + { + aLineInfo.SetLineCap( css::drawing::LineCap_SQUARE ); + break; + } + [[fallthrough]]; + case PS_ENDCAP_FLAT : + default : + aLineInfo.SetLineCap( css::drawing::LineCap_BUTT ); + } + switch( nStyle & PS_JOIN_STYLE_MASK ) + { + case PS_JOIN_ROUND : + aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::Round ); + break; + case PS_JOIN_MITER : + aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::Miter ); + break; + case PS_JOIN_BEVEL : + aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::Bevel ); + break; + default : + aLineInfo.SetLineJoin ( basegfx::B2DLineJoin::NONE ); + } + CreateObjectIndexed(nIndex, std::make_unique<WinMtfLineStyle>( aColorRef, aLineInfo, bTransparent )); } - CreateObjectIndexed(nIndex, std::make_unique<WinMtfLineStyle>( aColorRef, aLineInfo, bTransparent )); } } break; diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 93615d2c87d8..590fddd9e508 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -480,7 +480,7 @@ namespace emfio Color MtfTools::ReadColor() { - sal_uInt32 nColor; + sal_uInt32 nColor(0); mpInputStream->ReadUInt32( nColor ); Color aColor( COL_BLACK ); if ( ( nColor & 0xFFFF0000 ) == 0x01000000 ) diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 9d27787c205f..552896e892dd 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -898,13 +898,13 @@ namespace emfio // tdf#142625 Read the DIBHeader and check if bitmap is supported // If bitmap is not supported don't run ReadDIB, as it will interrupt image processing const auto nOldPos(mpInputStream->Tell()); - sal_uInt32 nHeaderSize; - sal_uInt16 nBitCount; + sal_uInt32 nHeaderSize(0); mpInputStream->ReadUInt32( nHeaderSize ); if ( nHeaderSize == 0xC ) // BitmapCoreHeader mpInputStream->SeekRel( 6 ); // skip Width (16), Height (16), Planes (16) else mpInputStream->SeekRel( 10 ); // skip Width (32), Height (32), Planes (16) + sal_uInt16 nBitCount(0); mpInputStream->ReadUInt16( nBitCount ); if ( nBitCount == 0 ) // TODO Undefined BitCount (JPEG/PNG), which are not supported break; |