Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Use smart-growing buffer size for compression #28

Open
wants to merge 1 commit into
base: wk_4.8.7
Choose a base branch
from

Conversation

pchk
Copy link
Contributor

@pchk pchk commented May 14, 2016

Usally buffer size that fits all compressed data is much lesser that
source uncompressed data size.
This routine has initial size of buffer = 10mb. Usually is is enough to
compress any image that comes to a printer. In the worst case the buffer
will grow up to :;compressBound result thats guarantees to fit all
compressed data.
Ex:
In pdf_fail.html(235kb) metioned in wkhtmltopdf/wkhtmltopdf#2684 nonScaled image
~300mb, real buffer size needed for compression will be ~3mb.

Usally buffer size that fits all compressed data is much lesser that
source uncompressed data size.
This routine has initial size of buffer = 10mb. Usually is is enough to
compress any image that comes to a printer. In the worst case the buffer
will grow up to :;compressBound result thats guarantees to fit all
compressed data.
Ex:
In pdf_fail.html(235kb) metioned in wkhtmltopdf/wkhtmltopdf#2684 nonScaled image
~300mb, real buffer size needed for compression will be ~3mb.
@@ -833,7 +833,31 @@ class jpg_header_reader {

};

bool QPdfEnginePrivate::smartCompressDeflate(const char *source, int size, QByteArray& compressed, unsigned long maxSize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a static function, as it's unlikely to be used outside of this file.

@ashkulz
Copy link
Member

ashkulz commented May 15, 2016

Please address the review comments and amend/rebase the changes, so that I can merge all the PRs together. Thanks for the detailed commit messages!

@ashkulz
Copy link
Member

ashkulz commented May 18, 2016

@pchk: any idea when you would be able to address the review comments?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants