summaryrefslogtreecommitdiff
path: root/base/gxclist.h
Commit message (Collapse)AuthorAgeFilesLines
* Split initialize device proc into two.Robin Watts2021-04-261-1/+1
| | | | | | | | | | | | | | | | | 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.
* Further rationalisation of device init.Robin Watts2021-04-201-2/+1
| | | | | | | | | | 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.
* Update copyright to 2021Chris Liddell2021-03-151-1/+1
|
* Extract clist setup code from prn and display device.Robin Watts2021-03-111-0/+10
| | | | Move to a common clist_mutatable function.
* Bug 695925: Implement overprint simulation for all devicesMichael Vrhel2021-02-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the capability to simulate overprint including that of spot colors for all devices including gray and RGB devices. This is achieved by having the PDF interpreter look if overprint is present, the seting of -dOverprint (/simulate /enable /disable), if the page has transparency, and if the page has spot colors. Depending upon the color model of the device, and if transparency is present, a special push of the pdf14 device may occur. The pdf14 device buffer collects the data in a CMYK or CMYK+spots buffer and the put_image method in the pdf14 device will map the buffer to the target device color space. The code was tested with devices that support and do not support spot colors, those that support and do not support alpha channels, tag based devices, gray, RGB, and CMYK devices. A special test file to check multiple cases was added to the regression suite. By default -dOverprint is set to /enable, which should result in the existing behavior where by RGB and Gray devices do no show overprint or spot colors and CMYK devices will handle CMYK overprinting and separation devices will show spots and overprint of all colorants. With -dOverprint set to /disable no device will show overprinting. With -dOverprint set to /simulate all devices will show overprint and spot colors. Ray Johnston did the work in the interpreter as well as the device parameter default setup. I did the pdf14 device changes and testing. Changes in a variety of locations were required due to the fact that new combinations were encountered, for example we had cases where devn colors were being used with a device that supports tags (bitrgbtags device and pdf14 compositor setup for CMYK+spots). One file: tests_private/xps/xpsfts-a4/fts_34xx.xps.pdf ppmraw 72 now produces an error. This file should have been throwing an error all along but was being quietly swallowed. Acrobat will not open the created pdf file and throws and error. I will open a bug for the issue as it is a problem with the XPS interpreter.
* FIx SEGV with gx_device_unsubclass when child is a clist device.Ray Johnston2020-10-311-1/+1
| | | | | | | | | | | | | | | | The 'band_range_list' was a structure of two pointers within the device (gx_device_clist_writer) so when it was copied, the 'ccl' pointer could point to the band_range_list structure in the child device. This pointer would no longer be valid when the child device was freed as the device unsubclass did. Detected with 15-01.BIN as it called gx_device_unsubclass for the PCL_mono subclass device. With -Z@ the band_range_list would be overwritten with (known, but invalid pointer) data resulting in the SEGV. Cured by putting the band_range_list into the clist_writer 'data' area. This area is not GC'ed and since it points into other memory in the clist writer 'cbuf' area, it is internal to the clist writer.
* Fix problem introduced by commit 6a3c36f8 with multi-threaded rendering.Ray Johnston2020-07-151-0/+5
| | | | | | That commit changed the allocation requirement in clist_init_states, but didn't change the corresponding calculation that is supposed to match. Make this a function so that both will agree going forward.
* Pass memory to clist_make_accum_device()Nancy Durgin2020-07-011-1/+1
| | | | | | | | | | | | | | | | Change function args to propagate the memory type of the graphics state to clist_make_accum_device to create device with it. Also, make sure the dev->bandlist_memory (used for freeing 'data') is allocated in the mem->non_gc_memory instead of the parent device's (fixes crash in gpdl/pcl that was introduced). That will mean pdfi and gs/pdfi get non-gc, and gs gets gc. There was a bug in gs/pdfi where the clist-pattern device was in gc memory and it was getting freed when pdfi was still using it. This should fix a segfault in: tests_private/comparefiles/Bug688396.pdf
* Remove clist "is_printer" field.Robin Watts2020-06-251-1/+1
| | | | | | | | | | Currently, the clist has an "is_printer" field, which is used to tell it how to forward dev_spec_op calls. This seems evil to me; a base class should not really need to know what class is being derived from it to know how to behave. Instead, introduce a function pointer that says where dev_spec_ops should be forwarded to.
* Refactor 'clist mutatable devices' from prn ones.Robin Watts2020-06-251-0/+46
| | | | | | | | | | | | Devices that have to mutate to be clist ones need to be setup in a particular way. After the standard gx_device header, they are padded out to a large enough size that the clist header fields can fit in. Then the device specific fields follow. gdev_prn devices are the standard example of this. In order to more easily allow other devices to work in the same way, we refactor the padding/clist specific fields out into new macros.
* Fix Bug702327: PS transparency operations before PUSH_DEVICE causes problems.Ray Johnston2020-05-231-0/+1
| | | | | Add check to make sure PUSH_DEVICE is the first pdf14 compositor action before allowing any other operation for page mode and clist mode.
* Update copyright to 2020Chris Liddell2020-04-101-1/+1
|
* Squashed commit fill-stroke3 branchMichael Vrhel2020-01-111-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix SEGV seen in saved-pages-test run.Robin Watts2019-07-151-2/+2
| | | | | | | | | | | | | | | | | The following job: membin/gs -Ilib -sOutputFile=out.%04d.psd --saved-pages-test -dMaxBitmap=10000 -sDEVICE=psdrgb -r300 -Z: -sDEFAULTPAPERSIZE=letter -dNOPAUSE -dBATCH -K2000000 -dClusterJob -dJOBSERVER /home/regression/cluster/tests_private/comparefiles/Bug691425.pdf SEGVs due to a buffer overrun. We are attempting to copy a list of up to GX_DEVICE_MAX_SEPARATIONS spot colors for the page into a list that's only GX_SOFT_MAX_SPOTS long. We just extend the storage here to cope.
* Update source/header file copyright notice to 2019Chris Liddell2019-01-161-1/+1
|
* Remove some blah_DEFINED cruft.Robin Watts2019-01-071-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we properly "include what we use" let's sanitise the horrid blah_DEFINED ifdeffery (i.e. kill it where possible). Also, we update the .c dependencies in the base/psi makefiles to be correct. Unfortunately, this new correct set of dependencies causes nmake to soil itself and die with an out of memory error. After much experimentation, I've come to the conclusion that this is because it copes poorly with given the same file as a dependency multiple times. Sadly, our style of declaring dependencies in the following style: foo_h=$(BLAH)/foo.h $(std_h) bar_h=$(BLAH)/bar.h $(foo_h) $(std_h) baz_h=$(BLAH)/baz.h $(foo_h) $(std_h) means that a .obj file that depends on $(foo_h) $(bar_h) and $(baz_h) ends up depending on foo.h twice, and std.h three times. I have therefore changed the style of dependencies used to be more standard. We still define: foo_h=$(BLAH)/foo.h so each .obj file rule can depend on $(foo_h) etc as required, but the dependencies between each .h file are expressed in normal rules at the end of the file in a dedicated "# Dependencies" section that we can now autogenerate.
* Update copyright notice with new head office address.Ken Sharp2018-01-301-3/+3
| | | | | | | | | Also update copyright dates. Remove gs_cmdl.ps as we no longer use it, and remove its entry from psfiles.htm. Remove xfonts.htm as this feature (xfont support) is long, long gone.
* Fix bug 696845 SEGV with --saved-pages-test and transparencyRay Johnston2017-11-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a file pushes a pdf14devicefilter (or other compositor) it will still be the currentdevice after the filter is popped when the saved pages printing occurs. We need to check if the device is a forwarding device (as compositors will be when deactivated) and use the target device to print the saved pages. Also, if a device uses the gx_default_dev_spec_op, it will return 0 from the supports_saved_pages call even when it is a printer device. In gdev_prn_forwarding_dev_spec_op, check for a zero return and return true (1). A device that is a printer device that doesn't support saved page printing needs to return < 0 to prevent this. Add a finalize method for gx_device_printer so we can free up the saved- pages-list when the device is freed, but not when the device is closed which can happen if it needs to close due to put_params. Also the return code from the output_page in gx_saved_page_params_process was ignored. Both seen with the file Bug687111.ps and the psdcmyk device. Also for devn devices, such as psdcmyk, we need to save the separation (spot color) names collected during the execution of setcolorspace in the gx_saved_page and set them in the devn_params when rendering. These are not handled by the paramlist. Disable --saved-pages= and --saved-pages-test with PCL and XPS since it was never completely implemented and the partial implementation causes many errors when tested with --saved-pages-test. Note that while the --saved-pages-test option is still accepted as a parameter, it is ignored so that regression testing with --saved-pages-test can run. Regression shows 3343 "diffs", but bmpcmp doesn't show any diffs.
* Remove the RECT_RECOVER and VMerror retrying logic from the clistRay Johnston2016-08-151-18/+1
| | | | | | | | The entire concept relies on recovery by being able to store an entire page raster image somewhere when the clist writing gets a VMerror, but if we have room for a page, we could have used page mode in the first place and totally avoid clist complexity VMerrors. Rip this code out to make the clist more readable and maintainable.
* Make gs_imager_state == gs_state.Chris Liddell2016-06-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change how gstate initialisation is done: Previously we relied on the imager state being a subset of the gstate (thus assigning an imager state to a graphics state over wrote to the entries common to both, and didn't overwrite any already set graphics state specific entries). Making the imager and graphics states the same means that approach doesn't work, so this changes it to initialise the entries individually. Renames gsistate.c->gsgstate.c and gxistate.h->gxgstate.h Cleanup and fix the gs_state gc stuff. Uses different check for pre/post clist pdf14 device Previously, the code used "is_gstate" in the imager/graphics state object to determine if the code was being called pre or post clist (post clist would only ever have had an imager_state so is_gstate = false). With no imager state any more, that test would no longer work (and I am dubious about whether it was really safe, anyway). Other places check for the presence of a clist reader device in the pdf14 device structure - so use that here too. Adds initial (NULL) value for show_gstate pointer in gs_state. Removes the now pointless macro for the contents of the graphics state Changes function names that had "imager" to use "gstate" Removes the redundant 'is_state' flag Cleans up gs_(g)state_putdeviceparams(): Previously we had to similar routines: one took a graphics state, and used the device from the graphics state, the other took an imager state and the device as an explicit parameter. With the removal of the imager state, "merge" those two functions Replaces gs_state with gs_gstate It makes for less confusion as it really is a g(raphics)state
* Commit of build_consolidation branchChris Liddell2015-07-201-0/+637
Squashed into one commit (see branch for details of the evolution of the branch). This brings gpcl6 and gxps into the Ghostscript build system, and a shared set of graphics library object files for all the interpreters. Also, brings the same configuration options to the pcl and xps products as we have for Ghostscript.