summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorofftkp <parisoplop@gmail.com>2022-07-16 19:10:19 +0300
committerTomaž Vajngerl <quikee@gmail.com>2022-07-19 13:05:03 +0200
commit1d548a2bc70e0b38e32ccae8b15b04bda84f3576 (patch)
tree1d5a5d2f62b786faa0a408c1b604d79621be70d9
parent4d9e9ff5f4cb199844eb1d2b4000bb837089347f (diff)
Replace old png writer in graphicfilter.cxx
Change-Id: I68b35e82fd5ca4de87b3b9c3c6be5cf802f071ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137132 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--vcl/source/filter/graphicfilter.cxx51
1 files changed, 5 insertions, 46 deletions
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index f7e3765f4e94..6aa2af7d23aa 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -34,7 +34,7 @@
#include <vcl/salctype.hxx>
#include <vcl/filter/PngImageReader.hxx>
#include <vcl/filter/SvmWriter.hxx>
-#include <vcl/pngwrite.hxx>
+#include <vcl/filter/PngImageWriter.hxx>
#include <vcl/vectorgraphicdata.hxx>
#include <vcl/virdev.hxx>
#include <impgraph.hxx>
@@ -1794,52 +1794,11 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, std::u16string_vi
}
else if ( aFilterName.equalsIgnoreAsciiCase( EXP_PNG ) )
{
- vcl::PNGWriter aPNGWriter( aGraphic.GetBitmapEx(), pFilterData );
+ auto aBitmapEx = aGraphic.GetBitmapEx();
+ vcl::PngImageWriter aPNGWriter( rOStm );
if ( pFilterData )
- {
- for ( const auto& rPropVal : *pFilterData )
- {
- if ( rPropVal.Name == "AdditionalChunks" )
- {
- css::uno::Sequence< css::beans::PropertyValue > aAdditionalChunkSequence;
- if ( rPropVal.Value >>= aAdditionalChunkSequence )
- {
- for ( const auto& rAdditionalChunk : std::as_const(aAdditionalChunkSequence) )
- {
- if ( rAdditionalChunk.Name.getLength() == 4 )
- {
- sal_uInt32 nChunkType = 0;
- for ( sal_Int32 k = 0; k < 4; k++ )
- {
- nChunkType <<= 8;
- nChunkType |= static_cast<sal_uInt8>(rAdditionalChunk.Name[ k ]);
- }
- css::uno::Sequence< sal_Int8 > aByteSeq;
- if ( rAdditionalChunk.Value >>= aByteSeq )
- {
- std::vector< vcl::PNGWriter::ChunkData >& rChunkData = aPNGWriter.GetChunks();
- if ( !rChunkData.empty() )
- {
- sal_uInt32 nChunkLen = aByteSeq.getLength();
-
- vcl::PNGWriter::ChunkData aChunkData;
- aChunkData.nType = nChunkType;
- if ( nChunkLen )
- {
- aChunkData.aData.resize( nChunkLen );
- memcpy( aChunkData.aData.data(), aByteSeq.getConstArray(), nChunkLen );
- }
- std::vector< vcl::PNGWriter::ChunkData >::iterator aIter = rChunkData.end() - 1;
- rChunkData.insert( aIter, aChunkData );
- }
- }
- }
- }
- }
- }
- }
- }
- aPNGWriter.Write( rOStm );
+ aPNGWriter.setParameters( *pFilterData );
+ aPNGWriter.write( aBitmapEx );
if( rOStm.GetError() )
nStatus = ERRCODE_GRFILTER_IOERROR;