diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2018-09-30 22:57:33 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2018-10-02 12:28:12 +0100 |
commit | cbdc54055b7db024951daf3dcb3cafe0af458e47 (patch) | |
tree | ca35d56a3537cbf846d4664a0dc54b9f2f3a58a6 /base/gdevnfwd.c | |
parent | 9565f4ca4aab712f411420fa4c8cae79a2cf88ed (diff) | |
download | ghostpdl-cbdc54055b7db024951daf3dcb3cafe0af458e47.tar.gz |
Change device put_image method to match the other methods in the API
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.
Diffstat (limited to 'base/gdevnfwd.c')
-rw-r--r-- | base/gdevnfwd.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/base/gdevnfwd.c b/base/gdevnfwd.c index 980170ec8..9c9440c71 100644 --- a/base/gdevnfwd.c +++ b/base/gdevnfwd.c @@ -112,6 +112,7 @@ gx_device_forward_fill_in_procs(register gx_device_forward * dev) fill_dev_proc(dev, update_spot_equivalent_colors, gx_forward_update_spot_equivalent_colors); fill_dev_proc(dev, ret_devn_params, gx_forward_ret_devn_params); fill_dev_proc(dev, fillpage, gx_forward_fillpage); + fill_dev_proc(dev, put_image, gx_forward_put_image); fill_dev_proc(dev, get_profile, gx_forward_get_profile); fill_dev_proc(dev, set_graphics_type_tag, gx_forward_set_graphics_type_tag); fill_dev_proc(dev, strip_copy_rop2, gx_forward_strip_copy_rop2); @@ -1013,7 +1014,21 @@ gx_forward_set_graphics_type_tag(gx_device *dev, gs_graphics_type_tag_t graphics dev->graphics_type_tag = (dev->graphics_type_tag & GS_DEVICE_ENCODES_TAGS) | graphics_type_tag; } -/* ---------------- The null device(s) ---------------- */ +int +gx_forward_put_image(gx_device *pdev, gx_device *mdev, const byte **buffers, int num_chan, int xstart, + int ystart, int width, int height, int row_stride, + int alpha_plane_index, int tag_plane_index) +{ + gx_device_forward * const fdev = (gx_device_forward *)pdev; + gx_device *tdev = fdev->target; + + if (tdev != 0) + return dev_proc(tdev, put_image)(tdev, mdev, buffers, num_chan, xstart, ystart, width, height, row_stride, alpha_plane_index, tag_plane_index); + else + return gx_default_put_image(tdev, mdev, buffers, num_chan, xstart, ystart, width, height, row_stride, alpha_plane_index, tag_plane_index); +} + +/* ---------------- The null device(s) ---------_plane_index------- */ static dev_proc_get_initial_matrix(gx_forward_upright_get_initial_matrix); static dev_proc_fill_rectangle(null_fill_rectangle); |