vcl/source/treelist/transfer.cxx |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 652bc0c107af6a41ca31c3d2adf1cc8137a94aa5
Author:     Tor Lillqvist <[email protected]>
AuthorDate: Tue May 28 21:51:53 2019 +0300
Commit:     Tor Lillqvist <[email protected]>
CommitDate: Fri Sep 20 14:12:04 2019 +0200

    tdf#124752: Use best speed for PNG encoding on iOS
    
    Still awfully slow for "realistic" images as taken by modern digital
    cameras, though. It would be much better to not encode the PNG to put
    on the clipboard from the internal bitmap representation, but use the
    ooriginal PNG or JPEG data.
    
    Change-Id: Ib72a573bd31d4ae7380dacccb4287e19afabb0d4
    Reviewed-on: https://gerrit.libreoffice.org/79230
    Reviewed-by: Tor Lillqvist <[email protected]>
    Tested-by: Tor Lillqvist <[email protected]>

diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 82ffa7dbde1b..1f73b377e5a8 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -670,7 +670,23 @@ bool TransferableHelper::SetBitmapEx( const BitmapEx& 
rBitmapEx, const DataFlavo
         if(rFlavor.MimeType.equalsIgnoreAsciiCase("image/png"))
         {
             // write a PNG
-            vcl::PNGWriter aPNGWriter(rBitmapEx);
+            css::uno::Sequence<css::beans::PropertyValue> aFilterData;
+
+#ifdef IOS
+            // Use faster compression on slow devices
+            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. For a
+            // typical 15 megapixel image from a DSLR, we are talking about a 
difference of 17 s for
+            // the default compression level vs 4 s for best speed, on an iPad 
Pro from 2017.
+            //
+            // Sure, the best would be to not have to re-encode the image at 
all, but have access to
+            // the original JPEG or PNG when there is a such.
+
+            aFilterData[aFilterData.getLength() - 1].Value <<= 1;
+#endif
+            vcl::PNGWriter aPNGWriter(rBitmapEx, &aFilterData);
 
             aPNGWriter.Write(aMemStm);
         }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to