[gs-commits] rev 12328 - trunk/gs/base
robin at ghostscript.com
robin at ghostscript.com
Wed Mar 30 10:17:10 UTC 2011
Author: robin
Date: 2011-03-30 10:17:10 +0000 (Wed, 30 Mar 2011)
New Revision: 12328
Modified:
trunk/gs/base/gdevdflt.c
trunk/gs/base/gdevdgbr.c
trunk/gs/base/gdevdrop.c
trunk/gs/base/gxclpath.c
trunk/gs/base/gxdevsop.h
Log:
Add new dev_spec_op operation for spotting that a device maps colours in
the 'standard' 1bit cmyk way, and use that rather than manually checking
function pointers. This allows bitcmyk, pamcmyk4 and plibk devices to
correctly spot the optimisation in get_bits (used for rops that use D).
Testing locally indicates that the special case is now taken, but that no
differences are seen in the results (as we would hope).
No cluster differences expected.
Modified: trunk/gs/base/gdevdflt.c
===================================================================
--- trunk/gs/base/gdevdflt.c 2011-03-30 10:16:54 UTC (rev 12327)
+++ trunk/gs/base/gdevdflt.c 2011-03-30 10:17:10 UTC (rev 12328)
@@ -917,6 +917,8 @@
return 0;
case gxdso_pattern_shfill_doesnt_need_path:
return (pdev->procs.fill_path == gx_default_fill_path);
+ case gxdso_is_std_cmyk_1bit:
+ return (pdev->procs.map_cmyk_color == cmyk_1bit_map_cmyk_color);
}
return gs_error_undefined;
}
Modified: trunk/gs/base/gdevdgbr.c
===================================================================
--- trunk/gs/base/gdevdgbr.c 2011-03-30 10:16:54 UTC (rev 12327)
+++ trunk/gs/base/gdevdgbr.c 2011-03-30 10:17:10 UTC (rev 12328)
@@ -20,6 +20,7 @@
#include "gxgetbit.h"
#include "gxlum.h"
#include "gdevmem.h"
+#include "gxdevsop.h"
int
gx_no_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
@@ -543,10 +544,13 @@
(options & GB_ALIGN_STANDARD ?
bitmap_raster(end_byte << 3) : end_byte);
}
- /* Check for the one special case we care about. */
+ /* Check for the one special case we care about, namely that we have a
+ * device that uses cmyk_1bit_map_cmyk_color, or equivalent. We do not
+ * check function pointers directly, as this is defeated by forwarding
+ * devices, but rather use a dev_spec_op. */
if (((options & (GB_COLORS_RGB | GB_ALPHA_FIRST | GB_ALPHA_LAST))
== GB_COLORS_RGB) &&
- dev_proc(dev, map_cmyk_color) == cmyk_1bit_map_cmyk_color) {
+ (dev_proc(dev, dev_spec_op)(dev, gxdso_is_std_cmyk_1bit, NULL, 0) > 0)) {
gx_get_bits_copy_cmyk_1bit(dest_line, raster,
src_line, dev_raster,
src_bit_offset & 7, w, h);
Modified: trunk/gs/base/gdevdrop.c
===================================================================
--- trunk/gs/base/gdevdrop.c 2011-03-30 10:16:54 UTC (rev 12327)
+++ trunk/gs/base/gdevdrop.c 2011-03-30 10:17:10 UTC (rev 12328)
@@ -25,6 +25,7 @@
#include "gxgetbit.h"
#include "gdevmem.h" /* for mem_default_strip_copy_rop prototype */
#include "gdevmrop.h"
+#include "gxdevsop.h"
/*
* Define the maximum amount of space we are willing to allocate for a
@@ -578,11 +579,16 @@
/* We know the device is a memory device, so we can store the
* result directly into its scan lines, unless it is planar. */
- pack = (tdev->num_planes <= 1 ?
- ((dev_proc(dev, map_cmyk_color) == cmyk_1bit_map_cmyk_color &&
- rop_depth == 24) ?
- pack_cmyk_1bit_from_standard : pack_from_standard) :
- pack_planar_from_standard);
+ if (tdev->num_planes <= 1) {
+ if ((rop_depth == 24) && (dev_proc(dev, dev_spec_op)(dev,
+ gxdso_is_std_cmyk_1bit, NULL, 0) > 0)) {
+ pack = pack_cmyk_1bit_from_standard;
+ } else {
+ pack = pack_from_standard;
+ }
+ } else {
+ pack = pack_planar_from_standard;
+ }
#ifdef DEBUG
if (gs_debug_c('b'))
trace_copy_rop("mem_default_strip_copy_rop",
Modified: trunk/gs/base/gxclpath.c
===================================================================
--- trunk/gs/base/gxclpath.c 2011-03-30 10:16:54 UTC (rev 12327)
+++ trunk/gs/base/gxclpath.c 2011-03-30 10:17:10 UTC (rev 12328)
@@ -31,6 +31,7 @@
#include "gzcpath.h"
#include "stream.h"
#include "gsserial.h"
+#include "gxdevsop.h"
/* Statistics */
#ifdef DEBUG
@@ -54,8 +55,8 @@
* We only know how to compute an accurate color set for the
* standard CMYK color mapping function.
*/
- if (dev_proc(cldev, map_cmyk_color) != cmyk_1bit_map_cmyk_color)
- return ((gx_color_index)1 << cldev->color_info.depth) - 1; /* What about tranparency? Need to check this */
+ if (dev_proc(cldev, dev_spec_op)(cldev, gxdso_is_std_cmyk_1bit, NULL, 0) <= 0)
+ return ((gx_color_index)1 << cldev->color_info.depth) - 1; /* What about transparency? Need to check this */
/*
* Note that c_base[0], and the low-order bit of plane_mask,
* correspond to cyan: this requires reversing the bit order of
Modified: trunk/gs/base/gxdevsop.h
===================================================================
--- trunk/gs/base/gxdevsop.h 2011-03-30 10:16:54 UTC (rev 12327)
+++ trunk/gs/base/gxdevsop.h 2011-03-30 10:17:10 UTC (rev 12328)
@@ -179,6 +179,14 @@
*/
gxdso_pattern_handles_clip_path,
+ /* gxdso_is_std_cmyk_1bit:
+ * data = NULL
+ * size = 0
+ * Returns 1 if the device is a 'standard' 1bit per component cmyk device.
+ * (standard means, 'maps colors equivalently to cmyk_1bit_map_cmyk_color')
+ */
+ gxdso_is_std_cmyk_1bit,
+
/* Add new gxdso_ keys above this. */
gxdso_pattern__LAST
};
More information about the gs-commits
mailing list