summaryrefslogtreecommitdiff
path: root/package/source/zippackage
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-11-12 21:25:55 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-11-17 10:49:24 +0100
commit0843ade74e5848c0babad509b10c334b01847be2 (patch)
treeccdb2447873bae5728d498a50b52ffe3f052670b /package/source/zippackage
parentd09b6209f1f374b6069089d8583c9ee373e3c1e5 (diff)
package: Do not bother with deflating jpeg images
It takes a lot of time and we can save ~1% of size if at all. Rather store them uncompressed in the zip file. With png, we can save a bit more, although it's still only about 4% - 8%? Change-Id: I43a3e3812882e4ce85e7af9d0aaab454d98c4860
Diffstat (limited to 'package/source/zippackage')
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 5eaa6e951220..64b48d3adfc5 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -773,6 +773,14 @@ bool ZipPackageStream::saveChild(
pTempEntry->nCompressedSize = pTempEntry->nSize = -1;
}
+ uno::Reference< io::XSeekable > xSeek(xStream, uno::UNO_QUERY);
+ // It's not worth to deflate jpegs to save ~1% in a slow process
+ if (xSeek.is() && msMediaType.endsWith("/jpeg"))
+ {
+ ImplSetStoredData(*pTempEntry, xStream);
+ xSeek->seek(0);
+ }
+
try
{
ZipOutputStream::setEntry(pTempEntry);
@@ -799,7 +807,6 @@ bool ZipPackageStream::saveChild(
{
bParallelDeflate = true;
// Do not deflate small streams in a thread
- uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY );
if (xSeek.is() && xSeek->getLength() < 100000)
bParallelDeflate = false;