summaryrefslogtreecommitdiff
path: root/base/gdevepo.c
Commit message (Collapse)AuthorAgeFilesLines
* Update postal address in file headersChris Liddell2023-04-041-3/+3
|
* Erasepage optimisation - prevent SEGV with display device on LinuxKen Sharp2022-11-301-2/+5
| | | | | | | | | | | The erasepage optimisation device uses the fill_rectangle method from the terminating device to do operations like actually erase the page. It turns out the display device (on Linux at least) doesn't actually implement this method (it may do so with a gtk+ build), leaving it at NULL, and causing a seg fault if we try to use it. Guard that here to prevent a crash.
* Bug 705203: Fix SEGV seen in overnights with pattern cache problem.Robin Watts2022-04-071-1/+2
| | | | | Introduce new lock_pattern device proc and clist implementation. Call that for fill_stroke operations.
* Fix '/undefined in /--pdfshowpage-finish' seen with Nup device.Robin Watts2021-09-071-2/+1
| | | | | | | | | | In tweaking the epo device, I'd messed up the forwarding of the 'composite' device call. The default subclass handling has some complex handling to cope with correctly ordering the devices. By simply forwarding the call on, I was missing this out. Fix this by calling the default subclass procedure to do the forwarding.
* Nup: Set PageUsesTransparency even when not present.Robin Watts2021-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several commits ago, I modified the Nup device so that whenever PageUsesTransparency was specified, we forced it to be true. This avoided PDF pages flushing the nest as we flip/flop between pages with and without transparency. Unfortunately, with parameters that were themselves 'collections' (like arrays), this would both leak a bit and corrupt them due to not copying them properly. Here we steal a bit of code from gsparamx.c to properly recursively copy such things, and hack it set PageUsesTransparency as part of the copy process. We also extend that to ensure that it is ALWAYS set (whether it is specified or not), to ensure that going from (say) a PS job to a PDF one does not cause the nest to be unnecessarily flushed. Also, because of the way params report errors, we need to copy the reported errors back from the copied param list to the original one. This requires extensions to the param list handling functions. Because put_params is not always called between the Nup device being instantiated and the first page started, we need to call put_params ourselves. To do that write our own install procedure and get gdevkrnlsclass.c to call that rather than doing the subclass itself. Also, incorporate a SEGV fix from Ray. The devn_put_params can close the device, but if the device is a child of the Nup device, the Nup device won't have a chance to flush the nest. Also, just in case, when we switch a printer device from clist mode (as we do when we tear down a device), clear the 'pmemdev->base' that is assumed to be NULL or valid in non-clist mode.
* Change epo device not to unsubclass itself each time.Robin Watts2021-09-011-36/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you have a device chain A -> epo -> C, then when epo unsubclasses itself, this moves device C into the memory previously occupied by epo. If this happens at 'unexpected' times, callers can be left holding a pointer to C that is now stale. The particular instance is running with the Nup device to psdcmyk. The device chain is therefore Nup -> epo -> psd. We get a put_params to change the device n parameters (the number of spots). This call filters down through Nup, epo, and reaches psd. That calls the devn prn code that spots this change, and closes the device. The close device jumps up the device chain to close Nup. This decides to flush the nest of pages rendered so far, so calls the epo device. This decides to unsubclass itself. This moves psd into the memory that epo used to occupy, frees the 'psd' pointer, and closes the psd device. This exits, returning back up the chain to where the devn prn code has just called gs_closedevice. That code is holding a dev pointer pointed to where psd used to be. As soon as it tries to access it it dies. In general, it's much less painful for the epo device to avoid 'unpredicated' unsubclassings, so we change it to stay linked in and just 'disable' itself.
* epo: Spawn the epo device as far down the stack as possible.Robin Watts2021-08-111-0/+4
| | | | | | Specifically, we want epo to be under Nup, but in general the purpose of epo is to avoid needless redrawing, which means we only need to wrap the actual rendering device.
* epo device: Only pass a fillpage on if one was sent.Robin Watts2021-08-111-1/+2
| | | | | | | | | | The N-up device has the effect of supressing all but the first fillpage for a nest. If the epo-device is spawned under an N-up device, this means it ends up clearing the complete page with color 0 (the value to which last_color is initialised). Here we tweak the device so that it only sends a fillpage if one has been swallowed.
* Subclassing: handle page_procs properly.Robin Watts2021-08-101-2/+2
| | | | | | | Currently, all subclassing devices redirect the page_procs to the defaults rather than passing them on to the devices. Fix that here.
* Remove "unread" param from get_bits_rectangle.Robin Watts2021-07-011-2/+2
| | | | No one sets it. No one reads it. It's pointless, so excise it.
* Rejig text_begin dev_proc.Robin Watts2021-06-151-3/+3
| | | | | | | | | | | | | | | | | | | In this commit we remove several parameters to the text_begin device procedure, because they are implied. Firstly, we remove pdcolor, and just use the device color from the current color in the graphics state (pgs->color[0]). This is actually what the code did anyway (in that it was assumed that pdcolor, if it was non-NULL was a pointer to this). Similarly, we remove the path param, as (if used) this is always the same as pgs->path. Finally, we remove the memory param as this is (almost always) the same as pgs->memory (and in cases where it isn't, tests indicate that it could be). This has knock on effects for the text enumerator structure.
* Remove get_bits in favour of get_bits_rectangle.Robin Watts2021-05-031-4/+5
|
* Remove strip_copy_rop in favour of strip_copy_rop2.Robin Watts2021-04-281-15/+0
|
* Split initialize device proc into two.Robin Watts2021-04-261-16/+17
| | | | | | | | | | | | | | | | | The device initialize function currently performs 2 jobs. Firstly, it fills out the device_procs. Secondly, it performs any minimal initialization required by the device (typically none). At various points in the code we want to be able to copy procs from one 'prototype' device to another, so we call initialize for that. This populates the device procs, but does other work that typically requires a 'derived device' structure rather than a vanilla gx_device to work in. Accordingly, we split the job into two; initialize_device_procs (the first part) and initialize_device (the second part). The initialize_device_procs function will set up the initialize_device function pointer along with the rest if required.
* Move devices away from begin_image to begin_typed_image.Robin Watts2021-04-231-14/+0
|
* Rename create_compositor to composite.Robin Watts2021-04-201-4/+4
|
* Remove obsolete copy_rop dev_proc.Robin Watts2021-04-201-15/+0
|
* Remove obsolete tile_rectangle dev_proc.Robin Watts2021-04-201-13/+0
|
* Remove obsolete draw_line dev_proc.Robin Watts2021-04-201-11/+0
|
* Further rationalisation of device init.Robin Watts2021-04-201-3/+3
| | | | | | | | | | Move the initialize procedure out of the device procs table, and into a bare function pointer at the start of the device proc. Devices just initialise this, and the rest should fall into place. This means changes to the device instantion macros (and all the uses thereof), but makes the code nicer overall. In particular, this removes the vestigial 'static_procs' structure.
* Move devices away from static init of procs.Robin Watts2021-04-201-76/+41
|
* Rename finish_copydevice to initialize, and remove second param.Robin Watts2021-04-201-5/+4
| | | | | | | | | | | It used to be that finish_copydevice(dev, const old_dev) would be used to copy stuff from a prototype to a new instance of a device. Now, no copying is ever done. Also, it's a confusing name. Rename it to be 'initialize', which is clearer. Also, it should become even more appropriate in future, if we have this function be the one that is responsible for filling out the procs.
* Erasepage optimisation - fix invalid device ordering assumptionKen Sharp2021-03-191-1/+6
| | | | | | | | | | | The erasepage optimisation device, when checking to see whether the underlying device permitted optimisaton, was assuming that its own child would always be the 'final' device. If we have a chain of subclass devices this might not be true. Run down the chain to the fist non-subclass device and check that instead. In future this should be replaced by a spec_op or something but this resolves the problem for now.
* Update copyright to 2021Chris Liddell2021-03-151-1/+1
|
* Fix erasepage_optimization device to allow for other subclass devices.Ray Johnston2021-03-031-18/+23
| | | | | | | | | The epo device assumed that it was the current device, then checked the child of that device to decide if it could optimize. If another subclass device was the current device the decision could be invalid. Note that the comparison of the child's fillpage proc is not ideal, but the change to that is more involved and risky, and left for a subsequent change.
* Strip trailing whitespace from .c and .h files.Robin Watts2020-09-091-10/+10
|
* Update copyright to 2020Chris Liddell2020-04-101-1/+1
|
* Squashed commit fill-stroke3 branchMichael Vrhel2020-01-111-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | This branch had several contributors including Robin Watts, Ken Sharp and Ray Johnston. The intent was to add a "fill and stroke" path device method to ensure we get proper rendering when doing fill/stroke methods with overprint and transparency. In addition, adding the method made it possible for pdfwrite to match the original pdf source file if it also had fill/stroke methods. The interaction with overprint and transparency led to significant changes in parts of the code related to those sections. In particular, overprint was reworked to ensure that the overprint compositor and the transparency compositor were aware if it was to be using the overprint drawn_comps for stroke or for fill. The code was rewritten so that the overprint compositor actions only occurred when an actual operation occurred (e.g. fill, stroke, image, text) as opposed to every time that the overprint graphic state values changed. When there is a fill-stroke operation with transparency, depending upon the graphic state values, a non-isolated knockout group may be pushed. From this, an issue with knockout groups within knockout groups was revealed, which was related to the backdrop selection. The backdrop selection code was simplified.
* Update source/header file copyright notice to 2019Chris Liddell2019-01-161-1/+1
|
* Add "transform_pixel_region" device function.Robin Watts2018-10-181-1/+12
| | | | | | | | | | | | | | | Use this for handling image type 4 rendering. The default version of this goes to rectangles. It also knows how to send portrait images of 8bps to copy_color. Next step is to write versions of this for the memory mapped devices to know how to go direct. Essentially we are copying the guts of the image_render_color_icc_{portrait,landscape,skew} into a default device method, and making the code that called those functions call the device method instead.
* Don't push the EPO device in front of the nulldeviceChris Liddell2018-10-161-1/+1
| | | | There are no bad effects from this, just pointless.
* Change device put_image method to match the other methods in the APIKen Sharp2018-10-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The put_image device method was unique in that the device parameter passed to the method was not a pointer to a device structure of the device implementing the method, but was a pointer to a device structure describing a memory device. This allowed the memory device to use code from the underlying device, which knows how its page buffer is laid out, but data from the memory device which rendered the composited transparent operations. However, this doesn't work at all if we have a chain of devices because the device method which we pull from the device at the head of the chain, is not the method used to actually rendeer to the page buffer of the terminating deevice in the chain. This commit alters the prorotype to take two device pointers, one for the 'terget' device, and one for the memory device which executed the put_image. This allows the final device in the chain to use its own code to format the buffer pointers from the memory device, while allowing intermediate devices to simply pass on the call. Note that previously a few places checked the put_image method against gx_default_put_image (before the device API rationalisation this was a check against NULL) and only called put_image if it was not the default. Now that we have a default implementation (which returns an error), and knowing that the existing device methods return an error if they do not implment some aspect of the memory layout, we can avoid the test altogether; simply call the put_image, the code is already prepared to deal with an error return whether that be because the device does not implement the method or becuase the device cannot cope with some aspect of the layout.
* Bug 699670: disallow copying of the epo deviceChris Liddell2018-08-281-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | The erasepage optimisation (epo) subclass device shouldn't be allowed to be copied because the subclass private data, child and parent pointers end up being shared between the original device and the copy. Add an epo_finish_copydevice which NULLs the three offending pointers, and then communicates to the caller that copying is not allowed. This also exposed a separate issue with the stype for subclasses devices. Devices are, I think, unique in having two stype objects associated with them: the usual one in the memory manager header, and the other stored in the device structere directly. In order for the stype to be correct, we have to use the stype for the incoming device, with the ssize of the original device (ssize should reflect the size of the memory allocation). We correctly did so with the stype in the device structure, but then used the prototype device's stype to patch the memory manager stype - meaning the ssize potentially no longer matched the allocated memory. This caused problems in the garbager where there is an implicit assumption that the size of a single object clump (c_alone == 1) is also the size (+ memory manager overheads) of the single object it contains. The solution is to use the same stype instance to patch the memory manager data as we do in the device structure (with the correct ssize).
* Fix compiler warningNancy Durgin2018-08-151-0/+3
|
* Change the debugging in epo to use the gs_debug stuffNancy Durgin2018-08-141-27/+22
| | | | | | | I am using 3 flags -- epo-details, epo-install-only, epo-disable. Can also call "epo_disable(1)" during a gdb session to turn on/off during the session.
* Bug 690131: Add epo subclass device to do erasepage optimization.Nancy Durgin2018-08-091-0/+665
This optimization only works for devices that have a fillpage implementation that is "gx_default_fillpage". For other devices the subclass device will not be installed. If the device transitions to clist (or any other non-gx_default_fillpage device), we will stop doing the optimization. The optimization basically swallows(defers) all fillpages, remembering the color (which is probably always white, but it will work with any "pure" color). Then when the first actual marking operation happens, we do a fill_rectangle operation with the remembered color.