[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - vcl/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 20 09:48:31 UTC 2019


 vcl/source/filter/graphicfilter.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 3d7419d01f963bb3ab5633968905a8e2a2e6f2bf
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Feb 27 14:28:55 2019 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Sep 20 11:47:31 2019 +0200

    tdf#122537: Use "best speed" instead of default compression level on iOS
    
    Speed is more important than size in the use case where this showed up
    in a profile of the iOS app (inserting an image). This change causes
    zlib's deflate_fast() being used instead of its deflate_slow(). For a
    specific image I tested with the former takes 1.5 s, the latter 3.4 s.
    
    This is just one aspect of the slowness of image insertio. The
    resizing operations mentioned in the bug report is not yet
    investigated.
    
    Change-Id: Icf023522b965cb0265000c821a478610d098cd0a
    Reviewed-on: https://gerrit.libreoffice.org/68434
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 68c8b98dfb9f3463bdc8f1233fd578e236e4d570)
    Reviewed-on: https://gerrit.libreoffice.org/79173

diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 0fb9b2992899..5da009d46bcf 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -2513,6 +2513,7 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData&, rData, bool )
 
     sal_uInt16      nFormat = GRFILTER_FORMAT_DONTKNOW;
     OString aShortName;
+    css::uno::Sequence< css::beans::PropertyValue > aFilterData;
     switch( rData.mnFormat )
     {
         case ConvertDataFormat::BMP: aShortName = BMP_SHORTNAME; break;
@@ -2540,8 +2541,17 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData&, rData, bool )
     else if( !aShortName.isEmpty() )
     {
         // Export
+#ifdef IOS
+        if (aShortName == PNG_SHORTNAME)
+        {
+            aFilterData.realloc(aFilterData.getLength() + 1);
+            aFilterData[aFilterData.getLength() - 1].Name = "Compression";
+            // We "know" that this gets passed to zlib's deflateInit2_(). 1 means best speed.
+            aFilterData[aFilterData.getLength() - 1].Value <<= 1;
+        }
+#endif
         nFormat = GetExportFormatNumberForShortName( OStringToOUString(aShortName, RTL_TEXTENCODING_UTF8) );
-        bRet = ExportGraphic( rData.maGraphic, OUString(), rData.mrStm, nFormat ) == ERRCODE_NONE;
+        bRet = ExportGraphic( rData.maGraphic, OUString(), rData.mrStm, nFormat, &aFilterData ) == ERRCODE_NONE;
     }
 
     return bRet;


More information about the Libreoffice-commits mailing list