summaryrefslogtreecommitdiff
path: root/source/fitz
AgeCommit message (Collapse)Author
2013-10-10Add scissor stack functionality to null device.Robin Watts
If the appropriate device hint is set, the null device will keep a scissor stack. This saves duplicating code in every device.
2013-10-10Add fz_new_png_from_pixmapRobin Watts
This accompanies the function formerly known as fz_image_as_png (now renamed to fz_new_png_from_image).
2013-10-09SVG: Support Type3 fonts and stroked fonts.Robin Watts
2013-10-09Fix typo in pixmap handling.Robin Watts
When creating a png, a typo meant that we ALWAYS converted the pixmap even when we had an rgb or grayscale image on entry. Also, treat mask pixmaps (no colorspace) as gray.
2013-10-07SVG device: Send text as reusable pathsRobin Watts
2013-10-07Update SVG device to send text as pathsRobin Watts
2013-09-30Disable image interpolation with a hint.Robin Watts
Set the hint in mudraw when AA bits is set to 0.
2013-09-30Bug 694526: Spot non-invertable matrices and bale before strokingRobin Watts
The bug fix added in the previous commit fails to work in this case (hang-9527.pdf) because the matrix is not invertible and hence the clipping rectangle ends up infinite. Spot this case here and return early.
2013-09-30Bug 694526: Fix hang in stroking path.Robin Watts
The first file of this bug (hang-66.pdf) hangs while stroking a VERY long line segment; so long that 'used' is sufficinetly large that: used += dash_segment_len doesn't result in a change in the value of used. The fix is to clip strokes to the edge of the gel's clip area, meaning that this should never occur.
2013-09-27fix bug 694573Simon Bünzli
Currently, MuPDF throws away entire CCITT encoded images whenever an error happens in the code stream. Other PDF readers seem to rather render what has been decoded up to the point of the error. This patch enables such behavior for MuPDF as well.
2013-09-27add support for .tga output to mudrawSimon Bünzli
SumatraPDF's testsuite uses Targa images as output because they're compressed while still far easier to compare than PNG and have better tool support than PCL/PWG.
2013-09-27fix some MSVC warningsSimon Bünzli
* unreachable code in fz_generate_transition * signed/unsigned comparison in get_comp_index * potential dataloss due to conversion from int to short in ucdn_mirror
2013-09-27don't color transform RGB JPEG-in-TIFF imagesSimon Bünzli
TIFF images containing JPEG data only require color transformation for CYMK data streams. For RGB streams, this could lead to unexpected results.
2013-09-27don't reset the clipping rectangle for accumulated textSimon Bünzli
FZ_CMD_CLIP_TEXT behaves quite differently whether the accumulate flag is set or not (see fz_list_clip_text). fz_run_display_list handles this correctly but fz_append_display_node doesn't do so yet.
2013-09-27clip flate stream on data check error instead of rejecting it wholesaleSimon Bünzli
This is required e.g. for 1798_-_zlib_incorrect_data_check.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-09-24Bug 694566: Avoid locking up while seeking in deflated stream.Robin Watts
In streams that we cannot seek in (such as flate ones) we implement seeking forward by skipping bytes. We failed to spot that we hit EOF, and spent ages just looping. Fix is simply to spot that we hit EOF and bale with a warning.
2013-09-23Fix missing 'const' in fz_authenticate_passwordRobin Watts
The pdf_ versions were already correct. Probably just an oversight that this was missed.
2013-09-13Fix various compile warnings spotted by the cluster.Robin Watts
2013-09-10Attempt to fix reflow.Robin Watts
2013-09-10support jpegtables for TIFF imagesSimon Bünzli
This is required e.g. for 2314 - jpeg tables in tiff.xps. This folds fz_open_resized_dct back into fz_open_dct instead of adding further variations for calls with and without the jpegtables argument.
2013-09-10Bug 694567: prevent double-free in pdf_open_raw_filterSimon Bünzli
If opening a filter in pdf_open_crypt throws, the stream is closed in the used fz_open_* method and thus mustn't be closed again.
2013-09-08Separate command and coordinate arrays in fz_path structure.Tor Andersson
2013-09-03Add FZ_VERSION define. Check header and library version compatibility.Tor Andersson
2013-09-02Improve SVG pattern handling.Robin Watts
In particular, cope with the cases where xstep/ystep are not the same as the tile width/heights.
2013-09-02Expose subpixel glyph adjustment calculations.Robin Watts
Pull subpixel glyph adjustment calculations into fz_subpixel_adjust. This reduces the repetition of code, and will be helpful for the OpenGL device.
2013-09-02Add glyph rendering routines that return fz_pixmaps rather than fz_glyphs.Robin Watts
These do no caching, and are intended to be useful for the opengl device.
2013-09-02Be smarter when quantising sub pixel positions for glyphs.Robin Watts
For large glyphs, sub pixel positioning is supremely unimportant. Even for smaller glyphs, we don't need 5*5 possible sub pixel positions. Base the degree of sub pixel quantisation on the size of the glyphs. This should result in better cache use. We push all the glyph sub positioning logic into fz_render_glyph (and fz_render_stroked_glyph). This simplifies the calling code. We also tweak fz_render_glyph so that it updates the transform it is called with to reflect the sub pixel positioning. This solves various problems: Firstly, we can round positions both up and down to achieve a smaller net displacement (e.g. (0.99, 0.99) can go to (1,1) rather than (0.75, 0.75) if we have a subpixel position resolution of 1/4 pixels). Secondly, glyphs that are drawn from outlines will have exactly the same subpixel changes applied. This is unlikely to be noticable, but it does mean that baselines should avoid having any shifts in them. Finally, it enables us to avoid lots of unnecessary copying of matrices, hopefully reducing overhead.
2013-08-30Use RLE coding scheme for glyph bitmaps.Robin Watts
Rather than generating fz_pixmaps for glyphs, we generate fz_glyphs. fz_glyphs can either contain a pixmap, or an RLEd representation (if it's a mask, and it's smaller). Should take less memory in the cache, and should be faster to plot.
2013-08-30Add simple banding to mudraw.Robin Watts
The most complex part here is to ensure that we can output various bitmaps in bands.
2013-08-29Add new fz_putc and fz_new_output_to_filename functions.Robin Watts
fz_putc; this fills a hole in our fz_output functions. fz_new_output_to_filename: This saves people having to create a FILE * just to pass to fz_new_output_with_file and then having to remember to close the FILE *.
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-08-28support deprecated JPEG-in-TIFF compressionSimon Bünzli
This fixes at least 2347 - old-style tiff jpeg compression.xps.
2013-08-28better JPEG image resolution detection (for XPS)Simon Bünzli
XPS extracts the resolution of a JPEG image from the image data. The current code however only reads the density values provided by JFIF metadata, while the XPS specification also allows for resolution to be in either EXIF metadata or Photoshop's APP13 chunk. This patch adds code for reading both kinds of metadata in order to get more consistent behavior with Microsoft's XPS Viewer. Documents for reproducing this issue: 2093*.xps, 2249*.xps, 2252*.xps, 2268*.xps and "jpeg exif resolution.xps". Another detail: The default resolution for JPEG images in XPS documents is 96 DPI and not 72 DPI.
2013-08-28fix memory leaksSimon Bünzli
* If fz_alpha_from_gray throws in fz_render_t3_glyph, then glyph is leaked. * If fz_new_image throws in pdf_load_image_imp, then colorspace and mask are leaked. * pdf_copy_pattern_gstate overwrites font and softmask without dropping them first.
2013-08-28sync bits when closing an LZW streamSimon Bünzli
Content streams may contain multiple inline images compressed as LZW data. The LZW filter used for such inline images might in some cases be closed in a state where less than 8 bits remain unread. The parent stream remembers that number (in stream->avail) and uses it again when reading the next inline image instead of resetting the remaining bit count when reading the next entire byte after the first inline image (or resetting it when closing the LZW stream as this patch does).
2013-08-28optionally detect initial EOL in CCITTFaxDecode streamsSimon Bünzli
If /EndOfLine is set for a CCITTFaxDecode stream, the image must start with an EOL per the spec. Other readers seem to ignore all data up to the first EOL in that case - instead of rejecting such images as broken. Required for e.g. "1848 - 1d faxd doesn't start with EOL.pdf".
2013-08-28fix various typosSimon Bünzli
2013-08-28Dump glyph cache size as part of mudraw -MRobin Watts
2013-08-28Fix big endian operation of paint code.Robin Watts
Broken in recent optimisations.
2013-08-26Optimise fz_paint_scan_with_color and fz_paint_spanRobin Watts
2013-08-26Optimise fz_paint_affine_near and similar fnsRobin Watts
This is the single largest hotspot in J11_acrobat.pdf on the pi, by a massive margin. J12_acrobat.pdf hits fz_paint_affine_g2rgb too.
2013-08-26Remove conditional code from draw-paint.cRobin Watts
If we want the alternative versions we can pull them out of git later.
2013-08-26Optimise fz_paint_span_with_color and fz_paint_solid_colorRobin Watts
The 2 biggest hotspots in benchmarking on the Raspberry pi at 1200dpi.
2013-08-26Fix memory leak in new glyph cache code.Robin Watts
Forgot to drop the font.
2013-08-22Rework glyph cache to enable partial eviction.Robin Watts
The current code uses a hash table with linear probing. This means that when the cache fills up, we have no alternative but to bin the whole thing (or do an expensive rebuild). Change to using a simple hash table with linked lists of bucket chains, and additional LRU lists. This way we can ditch the oldest glyphs as we need more space.
2013-07-26Narrow definition of whitespace according to XML spec.Robin Watts
Thanks to Tor for finding the correct definitions for me.
2013-07-26Add OpenXPS mime-type to fz_open_document.Tor Andersson
2013-07-25Bug 694402: Fix various SVG output problemsRobin Watts
Images were missing a space, hence giving errors. SVG text gets confused by leading (and repeated) whitespace, so elide it.