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
This commit is contained in:
Matúš Kukan
2014-11-12 21:25:55 +01:00
parent d09b6209f1
commit 0843ade74e

View File

@@ -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;