summaryrefslogtreecommitdiff
path: root/source/fitz/list-device.c
AgeCommit message (Collapse)Author
2016-03-14Remove begin_page and end_page device calls.Tor Andersson
To be moved into a new document writer interface later.
2016-02-24Add optional scissor hint argument to text clipping functions.Tor Andersson
2016-02-24Clarify scissor argument to clip device functions.Tor Andersson
The scissor argument is an optional (potentially NULL) rectangle that can give hints to devices about the area that can be scissored. This is used by the draw device and display list device to minimize the size of temporary clip mask buffers. The scissor rectangle, if used, must have been transformed by the current transform matrix.
2016-02-22Remove pointless casts from void*.Tor Andersson
Extraneous explicit type casts can mask errors, especially if a function prototype or return value changes in the future.
2016-02-22Drop const from fz_image.Tor Andersson
Image objects are immutable and opaque once constructed. Therefore there is no need for the const keyword.
2016-02-22Drop const from fz_shade.Tor Andersson
Shading objects are immutable and opaque once constructed. Therefore there is no need for the const keyword.
2016-01-21Drop const from fz_colorspace.Tor Andersson
It's an opaque immutable structure, that we don't expect to ever want to change after creation. Therefore the const keyword is not useful, and is only line noise.
2016-01-13Add lots of consts.Robin Watts
In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems.
2015-12-11Remove text clip accumulation.Tor Andersson
We can now group all clipped text into one fz_text object and simplify the device interface.
2015-09-14Add utility functions to help reduce device creation boilerplate.Tor Andersson
2015-07-20Improve Grid fitting of images for .gproof files.Robin Watts
By default in MuPDF, when we render an axis aligned image, we 'gridfit' it. This is a heuristic used to improve the rendering of tiled images, and avoid the background showing through on the antialiased edges. The general algorithm we use is to expand any image outwards so that it completely covers any pixels that it touches any part of. This is 'safe' in that we never cause any pixels to not be covered that should otherwise be so, and is important when we have images that are aligned with (say) line art rectangles. For gproof files though, this gives nasty results - because we have multiple images tiled across the page all exactly abutting, in most cases the edges will not be on exact integer coordinates. This means we expand both images and 1 (destination) pixel is lost. This severely hurts the rendering (in particular on text based pages). We therefore introduce a new type of grid fitting, where we simply align the edges of images to the closest integer pixel. This is safe because we know that neighbouring images will be adjusted identically and edges will stay coincident. We enable/disable this behaviour through a new device flag, and make the gproof interpreter set/clear this flag when generating the page - thus normal rendering is unaffected. We *could* have just poked the dev->flags fields directly, but that would require magic in the display list device to check for them being set/unset and to poke the dev->flags fields on playback, so instead we introduce a new fz_render_flags function (that calls a device function) to set/unset flags. The other attraction of this is that if we ever have devices that 'filter', we can neatly handle passing flag changes on with those. Currently the display list implementation only copes with set/clear of the FZ_DEVFLAG_GRIDFIT_AS_TILED option. We only readily have 6 bits available to us, so we'll just extend this as required if we add new render flags.
2015-03-24Path packing for memory efficiency.Robin Watts
Introduce the concept of 'packed' paths. These reduce the header overhead for most common paths (ones with less than 256 commands and 256 coords) to a single 32bit int once stored in the display list. The previous commit reduces the torture-test.pdf from 95 to 87Meg. This commit futher reduces it to 70Meg.
2015-03-24Don't pass interpreter context to pdf_processor opcode callbacks.Tor Andersson
Update buffer and filter processors. Filter both colors and stroke states. Move OCG hiding logic into interpreter.
2015-02-24Update display list tile skipping.Robin Watts
When we meet cached tiles when rendering the display list, we need to skip over their contents. Previously we did this by skipping display list nodes in their entirety. With the new display list scheme however, we cannot simply skip nodes completely as the graphic state changes must be remembered. We therefore update the list playback routine to keep track of the clip depth and to skip the function calls as required.
2015-02-24Fix incorrect object culling in display list.Robin Watts
I was testing an untransformed rectangle. This was not being picked up as our cluster tests use the identity matrix.
2015-02-24Squash some warnings from scan build.Robin Watts
2015-02-20Rejig display device to have a more compact memory representation.Robin Watts
Rather than a linked list of display nodes, we use solid block of serialised data. We send a 32bit word, which contains various bitfields. These bitfields indicate the command type, and the presence or absence of various fields (such as paths, colorspaces, colors etc). If these fields are not present, they are held to be the same as the previous values.
2015-02-17Use embedded superclass struct instead of user pointer in devices.Tor Andersson
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-17Reference count fz_path and fz_text.Tor Andersson
Disallow modification of shared fz_path and fz_text objects. They should follow a create once, consume often pattern, and as such should be immutable once created.
2014-09-09test-device: Abort interpretation when color found.Robin Watts
Add a new class of errors and use them to abort interpretation when the test device detects a color page.
2014-06-26Partially revert "Add missing fz_var() and fix potential memory leak."Matt Holgate
(Revert the fix for potential memory leak - there wasn't a potential memory leak as the device only takes ownership of it's display list if dev->free_user is set). This reverts commit ada560eb015e7b2208c492d47f28da8093733c4a.
2014-06-26Add missing fz_var() and fix potential memory leak.Matt Holgate
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-06-26Silence compiler warnings.Tor Andersson
2013-06-20Rearrange source files.Tor Andersson