summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2019-05-28 21:51:53 +0300
committerTor Lillqvist <tml@collabora.com>2019-05-28 22:44:00 +0300
commite1cd536edd2636d150ae50b0d44a5aee1b8d4e34 (patch)
tree39f58095a6dd0cc59df1193fb1e6a0dfcb9b50b3 /vcl/source
parent8291f1ebc2f95611a073dc62e204348b0dc7c87c (diff)
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
Diffstat (limited to 'vcl/source')
-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 c9cf060a4fc7..3f7d7c5a655c 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -664,7 +664,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);
}