vcl/source/filter/etiff/etiff.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
New commits: commit 2b7979d781b9e46161dcdfcab0e258af5e0b12b6 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Mon Jun 13 21:11:01 2022 +0200 Commit: Julien Nabet <serval2...@yahoo.fr> CommitDate: Mon Jun 13 21:14:06 2022 +0200 Revert "tdf#98743: TIFF export uses 96dpi by default" This reverts commit 988285410f8883ad49f32c4b804c4f5bd14569d0. It worked with brand new file and A4 example but not with attachment of the bugtracker. Change-Id: Ia33d06a994dd80a8fe0e0837f4e91fc8fdd5ce63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135795 Tested-by: Julien Nabet <serval2...@yahoo.fr> Reviewed-by: Julien Nabet <serval2...@yahoo.fr> diff --git a/vcl/source/filter/etiff/etiff.cxx b/vcl/source/filter/etiff/etiff.cxx index 2bfaea923c23..b34accab889b 100644 --- a/vcl/source/filter/etiff/etiff.cxx +++ b/vcl/source/filter/etiff/etiff.cxx @@ -191,8 +191,15 @@ bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem const * pF if ( ImplWriteHeader( aAnimation.Count() > 0 ) ) { - ImplWriteResolution( mnXResPos, 96 ); - ImplWriteResolution( mnYResPos, 96 ); + Size aDestMapSize( 300, 300 ); + const MapMode& aMapMode( aBmp.GetPrefMapMode() ); + if ( aMapMode.GetMapUnit() != MapUnit::MapPixel ) + { + const Size aPrefSize( rGraphic.GetPrefSize() ); + aDestMapSize = OutputDevice::LogicToLogic(aPrefSize, aMapMode, MapMode(MapUnit::MapInch)); + } + ImplWriteResolution( mnXResPos, aDestMapSize.Width() ); + ImplWriteResolution( mnYResPos, aDestMapSize.Height() ); if ( mnPalPos ) ImplWritePalette(); ImplWriteBody(); @@ -440,14 +447,14 @@ void TIFFWriter::ImplWriteBody() } -void TIFFWriter::ImplWriteResolution( sal_uInt64 nStreamPos, sal_uInt32 nResolutionValue ) +void TIFFWriter::ImplWriteResolution( sal_uInt64 nStreamPos, sal_uInt32 nResolutionUnit ) { sal_uInt64 nCurrentPos = m_rOStm.Tell(); m_rOStm.Seek( nStreamPos + 8 ); m_rOStm.WriteUInt32( nCurrentPos - mnStreamOfs ); m_rOStm.Seek( nCurrentPos ); - m_rOStm.WriteUInt32( nResolutionValue ); m_rOStm.WriteUInt32( 1 ); + m_rOStm.WriteUInt32( nResolutionUnit ); }