diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-01-01 21:07:19 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-01-01 21:07:19 +0000 |
commit | a2aceeb00de1529292709894bdb39b676a3f2337 (patch) | |
tree | 7e4da033023a87b7a1afd2e41254e1720fe5b4fc /vcl/source/gdi/impgraph.cxx | |
parent | b560dc89e4c86cf624c327fd393e2c3166d66251 (diff) |
return earlier, no logic change intended
Change-Id: Icd75c46eb57c059fb60fd9701e6bb1fb651d8f3f
Diffstat (limited to 'vcl/source/gdi/impgraph.cxx')
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 141 |
1 files changed, 71 insertions, 70 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 98d57ac32765..5689f27b0b96 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1520,86 +1520,87 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic ) void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic) { - if( !rOStm.GetError() ) + if (rOStm.GetError()) + return; + + if (rImpGraphic.ImplIsSwapOut()) { - if( !rImpGraphic.ImplIsSwapOut() ) - { - if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) && - ( rOStm.GetCompressMode() & SvStreamCompressFlags::NATIVE ) && - rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative() && - !rImpGraphic.maPdfData.hasElements()) - { - // native format - rOStm.WriteUInt32( NATIVE_FORMAT_50 ); + rOStm.SetError( SVSTREAM_GENERALERROR ); + return; + } - // write compat info - std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStm, StreamMode::WRITE, 1 )); - pCompat.reset(); // destructor writes stuff into the header + if( ( rOStm.GetVersion() >= SOFFICE_FILEFORMAT_50 ) && + ( rOStm.GetCompressMode() & SvStreamCompressFlags::NATIVE ) && + rImpGraphic.mpGfxLink && rImpGraphic.mpGfxLink->IsNative() && + !rImpGraphic.maPdfData.hasElements()) + { + // native format + rOStm.WriteUInt32( NATIVE_FORMAT_50 ); - rImpGraphic.mpGfxLink->SetPrefMapMode( rImpGraphic.ImplGetPrefMapMode() ); - rImpGraphic.mpGfxLink->SetPrefSize( rImpGraphic.ImplGetPrefSize() ); - WriteGfxLink( rOStm, *rImpGraphic.mpGfxLink ); - } - else - { - // own format - const SvStreamEndian nOldFormat = rOStm.GetEndian(); - rOStm.SetEndian( SvStreamEndian::LITTLE ); + // write compat info + std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStm, StreamMode::WRITE, 1 )); + pCompat.reset(); // destructor writes stuff into the header - switch( rImpGraphic.ImplGetType() ) - { - case GraphicType::NONE: - case GraphicType::Default: - break; + rImpGraphic.mpGfxLink->SetPrefMapMode( rImpGraphic.ImplGetPrefMapMode() ); + rImpGraphic.mpGfxLink->SetPrefSize( rImpGraphic.ImplGetPrefSize() ); + WriteGfxLink( rOStm, *rImpGraphic.mpGfxLink ); + } + else + { + // own format + const SvStreamEndian nOldFormat = rOStm.GetEndian(); + rOStm.SetEndian( SvStreamEndian::LITTLE ); - case GraphicType::Bitmap: - { - if(rImpGraphic.getSvgData().get()) - { - // stream out Svg defining data (length, byte array and evtl. path) - // this is used e.g. in swapping out graphic data and in transporting it over UNO API - // as sequence of bytes, but AFAIK not written anywhere to any kind of file, so it should be - // no problem to extend it; only used at runtime - const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0')); - - rOStm.WriteUInt32( nSvgMagic ); - rOStm.WriteUInt32( rImpGraphic.getSvgData()->getSvgDataArrayLength() ); - rOStm.WriteBytes(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(), - rImpGraphic.getSvgData()->getSvgDataArrayLength()); - rOStm.WriteUniOrByteString(rImpGraphic.getSvgData()->getPath(), - rOStm.GetStreamCharSet()); - } - else if( rImpGraphic.ImplIsAnimated()) - { - WriteAnimation( rOStm, *rImpGraphic.mpAnimation ); - } - else - { - WriteDIBBitmapEx(rImpGraphic.maEx, rOStm); - } - } - break; + switch( rImpGraphic.ImplGetType() ) + { + case GraphicType::NONE: + case GraphicType::Default: + break; - default: - { - if (rImpGraphic.maPdfData.hasElements()) - { - // Stream out PDF data. - rOStm.WriteUInt32(nPdfMagic); - rOStm.WriteUInt32(rImpGraphic.maPdfData.getLength()); - rOStm.WriteBytes(rImpGraphic.maPdfData.getConstArray(), rImpGraphic.maPdfData.getLength()); - } - if( rImpGraphic.ImplIsSupportedGraphic() ) - WriteGDIMetaFile( rOStm, rImpGraphic.maMetaFile ); - } - break; + case GraphicType::Bitmap: + { + if(rImpGraphic.getSvgData().get()) + { + // stream out Svg defining data (length, byte array and evtl. path) + // this is used e.g. in swapping out graphic data and in transporting it over UNO API + // as sequence of bytes, but AFAIK not written anywhere to any kind of file, so it should be + // no problem to extend it; only used at runtime + const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0')); + + rOStm.WriteUInt32( nSvgMagic ); + rOStm.WriteUInt32( rImpGraphic.getSvgData()->getSvgDataArrayLength() ); + rOStm.WriteBytes(rImpGraphic.getSvgData()->getSvgDataArray().getConstArray(), + rImpGraphic.getSvgData()->getSvgDataArrayLength()); + rOStm.WriteUniOrByteString(rImpGraphic.getSvgData()->getPath(), + rOStm.GetStreamCharSet()); + } + else if( rImpGraphic.ImplIsAnimated()) + { + WriteAnimation( rOStm, *rImpGraphic.mpAnimation ); + } + else + { + WriteDIBBitmapEx(rImpGraphic.maEx, rOStm); } + } + break; - rOStm.SetEndian( nOldFormat ); + default: + { + if (rImpGraphic.maPdfData.hasElements()) + { + // Stream out PDF data. + rOStm.WriteUInt32(nPdfMagic); + rOStm.WriteUInt32(rImpGraphic.maPdfData.getLength()); + rOStm.WriteBytes(rImpGraphic.maPdfData.getConstArray(), rImpGraphic.maPdfData.getLength()); + } + if( rImpGraphic.ImplIsSupportedGraphic() ) + WriteGDIMetaFile( rOStm, rImpGraphic.maMetaFile ); } + break; } - else - rOStm.SetError( SVSTREAM_GENERALERROR ); + + rOStm.SetEndian( nOldFormat ); } } |