vcl/source/filter/graphicfilter2.cxx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
New commits: commit 3682ef9da1ba3b6479e6bd6bf6d9705c784b4fd4 Author: offtkp <parisop...@gmail.com> AuthorDate: Fri Aug 12 21:35:25 2022 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Aug 22 18:03:17 2022 +0200 Remove code duplication in GraphicDescriptor for MET GraphicFormatDetector and GraphicDescriptor have duplicate format detection code so now GraphicDescriptor uses GraphicFormatDetector functions instead to detect the format for MET files Change-Id: I3188fe4bcdd5e0d9a942c6606d28a01c56319619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138210 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 59b468a5317e..93588c40c229 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -943,12 +943,15 @@ bool GraphicDescriptor::ImpDetectDXF( SvStream& rStm, bool ) return bRet; } -bool GraphicDescriptor::ImpDetectMET( SvStream&, bool ) +bool GraphicDescriptor::ImpDetectMET( SvStream& rStm, bool ) { - bool bRet = aPathExt.startsWith( "met" ); - if (bRet) - aMetadata.mnFormat = GraphicFileFormat::MET; - + sal_Int32 nStmPos = rStm.Tell(); + vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false /*bExtendedInfo*/ ); + bool bRet = aDetector.detect(); + bRet &= aDetector.checkMET(); + if ( bRet ) + aMetadata = aDetector.getMetadata(); + rStm.Seek( nStmPos ); return bRet; } commit a1b2a8370e61ada2690a29a623d55b38bd7a7cf3 Author: offtkp <parisop...@gmail.com> AuthorDate: Fri Aug 12 21:30:19 2022 +0300 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Aug 22 18:03:05 2022 +0200 Remove code duplication in GraphicDescriptor for TGA GraphicFormatDetector and GraphicDescriptor have duplicate format detection code so now GraphicDescriptor uses GraphicFormatDetector functions instead to detect the format for TGA files Change-Id: I939426d3016c90500c2a250ef464213b0fd7d642 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138209 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index 01741afa7ec2..59b468a5317e 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -853,12 +853,15 @@ bool GraphicDescriptor::ImpDetectRAS( SvStream& rStm, bool ) return bRet; } -bool GraphicDescriptor::ImpDetectTGA( SvStream&, bool ) +bool GraphicDescriptor::ImpDetectTGA( SvStream& rStm, bool ) { - bool bRet = aPathExt.startsWith( "tga" ); - if (bRet) - aMetadata.mnFormat = GraphicFileFormat::TGA; - + sal_Int32 nStmPos = rStm.Tell(); + vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false /* bExtendedInfo */ ); + bool bRet = aDetector.detect(); + bRet &= aDetector.checkTGA(); + if ( bRet ) + aMetadata = aDetector.getMetadata(); + rStm.Seek( nStmPos ); return bRet; }