vcl/source/filter/png/PngImageWriter.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 9e775a73240c6d73d679409d0753334f8494ed14
Author:     offtkp <parisop...@gmail.com>
AuthorDate: Sun Jul 17 13:26:22 2022 +0300
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Jul 19 10:00:30 2022 +0200

    Add pHYs chunk export support in PngImageWriter
    
    Change-Id: Idbb9c8222cbfce9d908a0b17d082de291cd0e0d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137145
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 7db4e4b6bc98..516c21a555df 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -136,6 +136,14 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
             }
         }
 
+        if (rBitmapEx.GetPrefMapMode().GetMapUnit() == MapUnit::Map100thMM)
+        {
+            Size aPrefSize(rBitmapEx.GetPrefSize());
+            sal_uInt32 nPrefSizeX = o3tl::convert(aSize.Width(), 100000, 
aPrefSize.Width());
+            sal_uInt32 nPrefSizeY = o3tl::convert(aSize.Height(), 100000, 
aPrefSize.Height());
+            png_set_pHYs(pPng, pInfo, nPrefSizeX, nPrefSizeY, 1);
+        }
+
         png_set_compression_level(pPng, nCompressionLevel);
 
         int interlaceType = PNG_INTERLACE_NONE;

Reply via email to