summaryrefslogtreecommitdiff
path: root/source/fitz/image.c
AgeCommit message (Collapse)Author
2015-02-17Add helper functions to keep/drop reference counts with locking.Tor Andersson
Add locks around fz_path and fz_text reference counting.
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2015-02-17Rename fz_close_* and fz_free_* to fz_drop_*.Tor Andersson
Rename fz_close to fz_drop_stream. Rename fz_close_archive to fz_drop_archive. Rename fz_close_output to fz_drop_output. Rename fz_free_* to fz_drop_*. Rename pdf_free_* to pdf_drop_*. Rename xps_free_* to xps_drop_*.
2015-02-10Attempting to render a JPEG with xres and yres set to 1 fails.Robin Watts
We end up trying to scale the JPEG up 72 times and fail a malloc. A better plan is to make the image handler disbelieve any xres or yres values less than 72dpi. We take care to still preserve aspect ratios etc.
2014-07-18fix off-by-one error in fz_unblend_masked_tileSimon Bünzli
fz_image::n is used inconsistently: Sometimes it includes the alpha channel and sometimes it doesn't. At the point where fz_unblend_masked_tile is called, it doesn't.
2014-05-27Fix 693517: Support /SMask/Matte preblended images.Tor Andersson
2014-05-12better buffer underflow protection for ba15a8cd3238a3a3c098ad8b7d96cb0e405fc26fSimon Bünzli
2014-05-07Bug 695112: only patch height values in JPEG streamsSimon Bünzli
If the reported height is 0 or too large, use the image size reported in the PDF itself instead (in the case of height 0, the JPEG library is supposed to read the correct value from the DNL segment, but libjpeg doesn't support that).
2014-05-07Fix 695112: patch JPEG streams with missing dimensionsTor Andersson
If a JPEG stream is missing valid values for width/height (usually -1), Adobe Reader substitutes these using the values read from the PDF object. This can be done by scanning and patching the data before passing it to libjpeg. Thanks to zeniko for the patch.
2014-03-18Fix operator buffering of inline images.Robin Watts
Previously pdf_process buffer did not understand inline images. In order to make this work without needlessly duplicating complex code from within pdf-op-run, the parsing of inline images has been moved to happen in pdf-interpret.c. When the op_table entry for BI is called it now expects the inline image to be in csi->img and the dictionary object to be in csi->obj. To make this work, we have had to improve the handling of inline images in general. While non-inline images have been loaded and held in memory in their compressed form and only decoded when required, until now we have always loaded and decoded inline images immediately. This has been due to the difficulty in knowing how many bytes of data to read from the stream - we know the length of the stream once uncompressed, but relating this to the compressed length is hard. To cure this we introduce a new type of filter stream, a 'leecher'. We insert a leecher stream before we build the filters required to decode the image. We then read and discard the appropriate number of uncompressed bytes from the filters. This pulls the compressed data through the leecher stream, which stores it in an fz_buffer. Thus images are now always held in their compressed forms in memory. The pdf-op-run implementation is now trivial. The only real complexity in the pdf-op-buffer implementation is the need to ensure that the /Filter entry in the dictionary object matches the exact point at which we backstopped the decompression.
2014-03-17Ensure that small images don't subdivide more than they should.Robin Watts
Gridfitting can increase the required width/height of images by up to 2 pixels. This makes images that are rendered very small very sensitive to over quantisation. This can produce 'mushier' images than it should, for instance on tests/Ghent_V3.0/090_Font-Support_x3.pdf (pgmraw, 72dpi)
2014-01-17Avoid overflows in floating point causing illegal accessesRobin Watts
If the scale is too large, the calculation to determine the required size of a pixmap can overflow. This can lead to negative width/heights being passed in, which confuses the subsampling code, leading to SEGVs.
2014-01-16fix memory leaks in pdf_load_jpx and fz_new_image_from_pixmapSimon Bünzli
fz_new_image_from_pixmap expects that the pixmap's colorspace has two references which is contrary to expectations. If it instead addrefs the pixmap's colorspace, the only caller pdf_load_jpx can consistently drop the colorspace after passing it to fz_load_jpx. Also, if the contract is that whatever is passed into fz_new_image_from_pixmap belongs to the new image, then the pixmap also has to be dropped on error so that it isn't leaked.
2014-01-06add stub files for JPEG-XR supportSimon Bünzli
See SumatraPDF's repo for a Windows-only implementation using WIC.
2014-01-02Cull code unused as a result of the "tolerate inline images..." fix.Robin Watts
Remove code that's not used any more as a result of the previous fix, plus some code that was unused anyway.
2014-01-01tolerate inline images without EOF markersSimon Bünzli
This is required for e.g. 1980_-_compressed_inline_image.pdf and Bug690300.pdf .
2013-09-27stop checking if the result of fz_read is negativeSimon Bünzli
fz_read used to return a negative value on errors. With the introduction of fz_try/fz_catch, it throws an error instead and always returns non-negative values. This removes the pointless checks.
2013-08-28add FZ_IMAGE_JXR placeholder for downstream implementorsSimon Bünzli
2013-08-28invert color transformed CMYK JPEG imagesSimon Bünzli
This fixes among others 693274 - cmyk jpeg image.xps from bug 693274.
2013-07-19Initial work on progressive loadingRobin Watts
We are testing this using a new -p flag to mupdf that sets a bitrate at which data will appear to arrive progressively as time goes on. For example: mupdf -p 102400 pdf_reference17.pdf Details of the scheme used here are presented in docs/progressive.txt
2013-06-20Rename fz_image_to_pixmap to fz_new_pixmap_from_image.Tor Andersson
Match our naming conventions.
2013-06-20Rearrange source files.Tor Andersson