summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2019-05-28 21:51:53 +0300
committerTor Lillqvist <tml@collabora.com>2019-09-20 14:12:04 +0200
commit652bc0c107af6a41ca31c3d2adf1cc8137a94aa5 (patch)
tree1d57eed14bc4418dbb942271ed376f5855bf9efd
parentFix build breakage when no localisations are present in an iOS build (diff)
downloadcore-652bc0c107af6a41ca31c3d2adf1cc8137a94aa5.tar.gz
core-652bc0c107af6a41ca31c3d2adf1cc8137a94aa5.zip
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 <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--vcl/source/treelist/transfer.cxx18
1 files changed, 17 insertions, 1 deletions
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);
}